From 8222f3b7811557d2ca043bc5a98e024796326c37 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 13 Jan 2024 18:47:17 +0100 Subject: [PATCH] Adapt search tests since the simple backend is not so permissive as ElasticSearch Signed-off-by: Emmy D'Anello --- registration/tests.py | 6 ++---- tfjm/settings.py | 2 -- tfjm/settings_prod.py | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/registration/tests.py b/registration/tests.py index 3d1a4b1..3faa472 100644 --- a/registration/tests.py +++ b/registration/tests.py @@ -413,9 +413,7 @@ class TestRegistration(TestCase): """ Try to search some things. """ - call_command("rebuild_index", "--noinput", "-v", 0) - - response = self.client.get(reverse("haystack_search") + "?q=" + self.user.email) + response = self.client.get(reverse("haystack_search") + "?q=" + self.user.last_name) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["object_list"]) @@ -425,6 +423,6 @@ class TestRegistration(TestCase): self.assertTrue(response.context["object_list"]) response = self.client.get(reverse("haystack_search") + "?q=" + - self.student.registration.get_student_class_display()) + self.student.registration.school) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["object_list"]) diff --git a/tfjm/settings.py b/tfjm/settings.py index faea1b2..7c489ee 100644 --- a/tfjm/settings.py +++ b/tfjm/settings.py @@ -207,8 +207,6 @@ HAYSTACK_CONNECTIONS = { } } -HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' - _db_type = os.getenv('DJANGO_DB_TYPE', 'sqlite').lower() if _db_type == 'mysql' or _db_type.startswith('postgres') or _db_type == 'psql': # pragma: no cover diff --git a/tfjm/settings_prod.py b/tfjm/settings_prod.py index f53ec92..fa85b60 100644 --- a/tfjm/settings_prod.py +++ b/tfjm/settings_prod.py @@ -47,3 +47,5 @@ HAYSTACK_CONNECTIONS = { 'INDEX_NAME': 'haystack', } } + +HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'