Skip to content

Commit

Permalink
update fulltext tests to break signals
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonDavis committed Dec 11, 2024
1 parent 5efa64d commit 85574aa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions sde_collections/tests/test_import_fulltexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@
from unittest.mock import patch

import pytest
from django.db.models.signals import post_save

from sde_collections.models.collection import create_configs_on_status_change
from sde_collections.models.delta_url import DeltaUrl, DumpUrl
from sde_collections.tasks import fetch_and_replace_full_text
from sde_collections.tests.factories import CollectionFactory


@pytest.fixture
def disconnect_signals():
# Disconnect the signal before each test
post_save.disconnect(create_configs_on_status_change, sender="sde_collections.Collection")
yield
# Reconnect the signal after each test
post_save.connect(create_configs_on_status_change, sender="sde_collections.Collection")


@pytest.mark.django_db
def test_fetch_and_replace_full_text():
def test_fetch_and_replace_full_text(disconnect_signals):
collection = CollectionFactory(config_folder="test_folder")

mock_batch = [
Expand All @@ -31,7 +42,7 @@ def mock_generator():


@pytest.mark.django_db
def test_fetch_and_replace_full_text_large_dataset():
def test_fetch_and_replace_full_text_large_dataset(disconnect_signals):
"""Test processing a large number of records with proper pagination and batching."""
collection = CollectionFactory(config_folder="test_folder")

Expand Down

0 comments on commit 85574aa

Please sign in to comment.