diff options
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 10bc52967..bfd2a162b 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -3070,6 +3070,23 @@ class OperationSearchTest(TestCase, OperationInitTest, SearchText):          result = json.loads(response.content.decode())          self.assertEqual(result["recordsTotal"], 1) +    def test_or_search_vector(self): +        operation_1 = models.Operation.objects.get(pk=self.operations[0].pk) +        operation_2 = models.Operation.objects.get(pk=self.operations[1].pk) +        operation_1.common_name = "Château de Fougères" +        operation_1.save() +        operation_2.code_patriarche = "OA4242" +        operation_2.save() + +        c = Client() +        c.login(username=self.username, password=self.password) + +        patriarche_key = pgettext_lazy("key for text search", "patriarche") +        name_key = pgettext_lazy("key for text search", "name") +        request = f'{patriarche_key}="OA4242" || {name_key}="{operation_1.common_name}"' +        response = c.get(reverse("get-operation"), {"search_vector": request}) +        self.assertEqual(json.loads(response.content.decode())["recordsTotal"], 2) +      def test_complex_search_vector(self):          c = Client()          c.login(username=self.username, password=self.password)  | 
