summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-07-03 18:11:28 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-07-03 18:19:22 +0200
commit7ca43bf432f679dab4a834e81ad5b708fbbb06b0 (patch)
treed74a3632bc612c9d4405f9865ac36b90e63515fa /archaeological_finds/tests.py
parent6e10770d2c121a88be0368c8764c47596bc884ba (diff)
downloadIshtar-7ca43bf432f679dab4a834e81ad5b708fbbb06b0.tar.bz2
Ishtar-7ca43bf432f679dab4a834e81ad5b708fbbb06b0.zip
🐛 Fix "*" search for text fields (refs #5325)
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index d4a02b94d..b4612619b 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -1391,6 +1391,27 @@ class FindSearchTest(FindInit, TestCase, SearchText):
result = [('{}="{}"'.format(key, "Operation Common Name"), 1)]
self._test_search(c, result, context="Text Operation Common Name Search")
+ def test_description_search(self):
+ find = self.finds[0]
+ find.description = "A simple description."
+ find.save()
+ find2 = self.finds[1]
+ find2.description = ""
+ find2.save()
+ self.create_finds()
+ self.create_finds()
+
+ c = Client()
+ c.login(username=self.username, password=self.password)
+
+ key = str(pgettext_lazy("key for text search", "description"))
+ result = [('{}="{}"'.format(key, "A simple description."), 1)]
+ self._test_search(c, result, context="Text description Search")
+ result = [('{}="{}"'.format(key, "*"), 1)]
+ self._test_search(c, result, context="* description Search")
+ result = [('-{}="{}"'.format(key, "*"), models.Find.objects.count() - 1)]
+ self._test_search(c, result, context="-* description Search")
+
def test_address_operation_search(self):
operation = self.operations[0]
operation.address = "Street somewhere 29478 NOWHERE"