diff options
author | Cefin <kevon@tuta.io> | 2021-10-12 15:38:30 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:48 +0200 |
commit | b401a12a769ed96bd7209dba8b9286d4d95897e1 (patch) | |
tree | e01cdf2e9b8357cc1c9f91cf40e7aa18ed4c677c | |
parent | defd2ba78630f8a1f168d1a6ac63db19e56303d8 (diff) | |
download | Ishtar-b401a12a769ed96bd7209dba8b9286d4d95897e1.tar.bz2 Ishtar-b401a12a769ed96bd7209dba8b9286d4d95897e1.zip |
adding test for acrcheological finds search on operations
-rw-r--r-- | archaeological_finds/models_finds.py | 2 | ||||
-rw-r--r-- | archaeological_finds/tests.py | 72 |
2 files changed, 73 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index c32a72f93..aeb4aaf90 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1583,7 +1583,7 @@ class Find( pgettext_lazy("key for text search", "operation-address"), "base_finds__context_record__operation__address__iexact", ), - "base_finds__context_record__operation__person_in_charge": SearchAltName( + "base_finds__context_record__operation__in_charge": SearchAltName( pgettext_lazy("key for text search", "person-in-charge"), "base_finds__context_record__operation__in_charge__cached_label__iexact", ), diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 813153318..59ea1c199 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1152,6 +1152,12 @@ class FindSearchTest(FindInit, TestCase, SearchText): User.objects.create_superuser(self.username, "myemail@test.com", self.password) self.client = Client() + + def loggedIn_Client(): + c = Client() + return c.login(username=self.username, password=self.password) + + def test_material_type_hierarchic_search(self): find = self.finds[0] c = Client() @@ -1276,6 +1282,72 @@ class FindSearchTest(FindInit, TestCase, SearchText): ] self._test_search(c, result, context="Text period search") + def test_operator_search(self): + operation = self.operations[0] + operator = Organization.objects.create( + name="My Orga", + organization_type=OrganizationType.objects.all[0] + ) + operation.operator = operator + operation.save() + + c = Client() + c.login(username=self.username, password=self.password) + + key = str(pgettext_lazy("key for text search", "operator")) + result = [ + ('{}="{}"'.format(key, "My Orga"), 2) + ] + self._test_search(c, result, context="Text operator search") + + + def test_common_name_operation_search(self): + operation = self.operations[0] + operation.common_name = "Operation Common Name" + operation.save() + + c = Client() + c.login(username=self.username, password=self.password) + + key = str(pgettext_lazy("key for text search", "operation-name")) + result = [ + ('{}="{}"'.format(key, "Operation Common Name"), 1) + ] + self._test_search(c, result, context="Text Operation Common Name Search") + + + def test_address_operation_search(self): + operation = self.operation[0] + operation.address = "Street somewhere \n 29478 NOWHERE" + operation.save() + + c = Client() + c.login(username=self.username, password=self.password) + + key = str(pgettext_lazy("key for text search", "address")) + result = [ + ('{}="{}"'.format(key, "Street somewhere \n 29478 NOWHERE"), 1) + ] + self._test_search(c, result, context="Text Operation Address Search") + + + def test_person_in_charge_search(self): + operation = self.get_default_operationmodify + operation.in_charge = Person.objects.create( + raw_name="HISNAME Michel" + ) + operation.save() + + c = Client() + c.login(username=self.username, self.password) + + key = str(pgettext_lazy("key for text search", "person-in-charge")) + result = [ + ('{}="{}"'.format(key, "HISNAME Michel"), 1) + ] + self._test_search(c, result, context= "Text Person In Charge Search") + + def test_conservatory_state_hierarchic_search(self): find = self.finds[0] c = Client() |