diff options
author | Cefin <kevon@tuta.io> | 2021-10-12 15:38:30 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 9fffaf762e1206301881ed35048651ac8ba19c74 (patch) | |
tree | 1ca8c64fecc15c4786009c8cf14fe124bec117dc | |
parent | 8765df29ba9e1a33b9c9d3258a36fe535a556e71 (diff) | |
download | Ishtar-9fffaf762e1206301881ed35048651ac8ba19c74.tar.bz2 Ishtar-9fffaf762e1206301881ed35048651ac8ba19c74.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 4fee1283c..e3f3e6d7e 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1584,7 +1584,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() |