summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorCefin <kevon@tuta.io>2021-10-12 15:38:30 +0200
committerCefin <kevon@tuta.io>2021-10-13 10:57:40 +0200
commit64e5204d91d136c398ba0177c13322025459e0f0 (patch)
tree4fc329ef5ab621c37f493f4aa3219262d2a44e86 /archaeological_finds
parent3b807ab8394bc3a412631073b3c2c0b8d8715a16 (diff)
downloadIshtar-64e5204d91d136c398ba0177c13322025459e0f0.tar.bz2
Ishtar-64e5204d91d136c398ba0177c13322025459e0f0.zip
adding test for acrcheological finds search on operations
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_finds.py2
-rw-r--r--archaeological_finds/tests.py72
2 files changed, 73 insertions, 1 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 9f45299b9..0968b121f 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 1bb10824f..935c52c7e 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -1134,6 +1134,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()
@@ -1258,6 +1264,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()