Skip to content

Commit 85574aa

Browse files
committed
update fulltext tests to break signals
1 parent 5efa64d commit 85574aa

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sde_collections/tests/test_import_fulltexts.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@
33
from unittest.mock import patch
44

55
import pytest
6+
from django.db.models.signals import post_save
67

8+
from sde_collections.models.collection import create_configs_on_status_change
79
from sde_collections.models.delta_url import DeltaUrl, DumpUrl
810
from sde_collections.tasks import fetch_and_replace_full_text
911
from sde_collections.tests.factories import CollectionFactory
1012

1113

14+
@pytest.fixture
15+
def disconnect_signals():
16+
# Disconnect the signal before each test
17+
post_save.disconnect(create_configs_on_status_change, sender="sde_collections.Collection")
18+
yield
19+
# Reconnect the signal after each test
20+
post_save.connect(create_configs_on_status_change, sender="sde_collections.Collection")
21+
22+
1223
@pytest.mark.django_db
13-
def test_fetch_and_replace_full_text():
24+
def test_fetch_and_replace_full_text(disconnect_signals):
1425
collection = CollectionFactory(config_folder="test_folder")
1526

1627
mock_batch = [
@@ -31,7 +42,7 @@ def mock_generator():
3142

3243

3344
@pytest.mark.django_db
34-
def test_fetch_and_replace_full_text_large_dataset():
45+
def test_fetch_and_replace_full_text_large_dataset(disconnect_signals):
3546
"""Test processing a large number of records with proper pagination and batching."""
3647
collection = CollectionFactory(config_folder="test_folder")
3748

0 commit comments

Comments
 (0)