(backend) refactor indexation signals and fix circular import issues

Signed-off-by: Fabre Florian <ffabre@hybird.org>
This commit is contained in:
Fabre Florian
2025-09-12 14:11:23 +02:00
committed by Quentin BEY
parent 24460ffc3a
commit bf978b5376
7 changed files with 57 additions and 39 deletions

View File

@@ -3,11 +3,11 @@ Unit tests for the Document model
"""
# pylint: disable=too-many-lines
from operator import itemgetter
import random
import smtplib
import time
from logging import Logger
from operator import itemgetter
from unittest import mock
from django.contrib.auth.models import AnonymousUser
@@ -1651,13 +1651,13 @@ def test_models_documents_post_save_indexer(mock_push, settings):
indexer = FindDocumentIndexer()
assert sorted(data, key=itemgetter('id')) == sorted(
assert sorted(data, key=itemgetter("id")) == sorted(
[
indexer.serialize_document(doc1, accesses),
indexer.serialize_document(doc2, accesses),
indexer.serialize_document(doc3, accesses),
],
key=itemgetter('id'),
key=itemgetter("id"),
)
# The debounce counters should be reset

View File

@@ -36,7 +36,6 @@ class FakeDocumentIndexer(BaseDocumentIndexer):
return {}
@pytest.fixture(name="fake_indexer_settings")
def fake_indexer_settings_fixture(settings):
"""Fixture to switch the indexer to the FakeDocumentIndexer."""
@@ -103,6 +102,7 @@ def test_services_search_indexer_class(fake_indexer_settings):
"core.tests.test_services_search_indexers.FakeDocumentIndexer"
)
def test_services_search_indexer_url_is_none(settings):
"""
Indexer should raise RuntimeError if SEARCH_INDEXER_URL is None or empty.