diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-14 18:53:00 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-15 11:15:48 +0100 |
commit | cbe5632f6be526afa0e2ff0bb58c0cad3070b8b8 (patch) | |
tree | a724a24748f762f40e1f57fc53b5a39d20861925 /archaeological_operations/tests.py | |
parent | b434924e40795014617a57f616d164cdad6c430d (diff) | |
download | Ishtar-cbe5632f6be526afa0e2ff0bb58c0cad3070b8b8.tar.bz2 Ishtar-cbe5632f6be526afa0e2ff0bb58c0cad3070b8b8.zip |
🐛 search: fix -type="*" search for types with no hierarchy
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 331c24659..afa484839 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -3190,6 +3190,25 @@ class OperationSearchTest(TestCase, OperationInitTest, SearchText): ] self._test_search(c, result, context="Facet search with * characters") + def test_search_has_type_filled_or_not(self): + c = Client() + c.login(username=self.username, password=self.password) + ope = self.operations[0] + ope.report_processing = models.ReportState.objects.all()[0] + ope.save() + final_neo = models.Period.objects.get(txt_idx="final-neolithic") + ope.periods.add(final_neo) + nb = models.Operation.objects.count() + self.assertTrue(nb > 1) + + search_name_q = str(pgettext("key for text search", "report-processing")) + result = [(f'{search_name_q}="*"', 1), (f'-{search_name_q}="*"', nb - 1)] + self._test_search(c, result, context="Search filled or not - simple type") + + search_name_q = str(pgettext_lazy("key for text search", "period")) + result = [(f'{search_name_q}="*"', 1), (f'-{search_name_q}="*"', nb - 1)] + self._test_search(c, result, context="Search filled or not - hierarchical type") + def test_hierarchic_search(self): ope = self.operations[1] c = Client() |