diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-07-03 19:29:27 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-13 18:26:03 +0200 |
commit | 0ddd8bd878d7a13f8ab8159b0f95d1d49c415fc3 (patch) | |
tree | 808dc89ca069834f9b00b73d192dc200827c2c15 /archaeological_operations/tests.py | |
parent | 6e443ef21bfa9eea67e7f983727c41d00405a816 (diff) | |
download | Ishtar-0ddd8bd878d7a13f8ab8159b0f95d1d49c415fc3.tar.bz2 Ishtar-0ddd8bd878d7a13f8ab8159b0f95d1d49c415fc3.zip |
Manage interger field search and many search (refs #4180)
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 4a27660d0..19724ff8b 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1559,6 +1559,10 @@ class OperationSearchTest(TestCase, OperationInitTest): final_neo = models.Period.objects.get(txt_idx='final-neolithic') gallo = models.Period.objects.get(txt_idx="gallo-roman") ope1.periods.add(final_neo) + ope1.year = 2042 + ope1.save() + ope2.year = 2020 + ope2.save() ope1.periods.add(gallo) ope2.periods.add(neo) ope3.periods.add(gallo) @@ -1576,6 +1580,23 @@ class OperationSearchTest(TestCase, OperationInitTest): result = json.loads(response.content) self.assertEqual(result['recordsTotal'], 1) + # integer field + search_year_q = unicode( + pgettext("key for text search (no accent, no spaces)", u"year") + ) + search = {'search_vector': u'{}="2042"'.format(search_year_q)} + response = c.get(reverse('get-operation'), search) + self.assertEqual(response.status_code, 200) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 1) + + # many integer field + search = {'search_vector': u'{}="2042";"2020"'.format(search_year_q)} + response = c.get(reverse('get-operation'), search) + self.assertEqual(response.status_code, 200) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 2) + # hierarchic search = {'search_vector': u'{}="{}"'.format(search_q, neo.label)} response = c.get(reverse('get-operation'), search) @@ -1648,7 +1669,7 @@ class OperationSearchTest(TestCase, OperationInitTest): response = c.get(reverse('get-operation'), search) self.assertEqual(json.loads(response.content)['recordsTotal'], 2) - def testHierarchicSearch(self): + def test_hierarchic_search(self): ope = self.operations[1] c = Client() |