diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-10-28 12:22:50 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-02-19 14:43:48 +0100 |
commit | ebc72b876824b333bed368afaf3f700736b6b390 (patch) | |
tree | ebae3b2706c0fc13042b59f07fc63deda106de18 /archaeological_operations/tests.py | |
parent | 4f60b4805a7eac04c2a8ec2116a245dbeec3c822 (diff) | |
download | Ishtar-ebc72b876824b333bed368afaf3f700736b6b390.tar.bz2 Ishtar-ebc72b876824b333bed368afaf3f700736b6b390.zip |
✨ search add OR "||" - search refactoring
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) |