diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-07-03 13:06:01 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-13 18:26:03 +0200 |
commit | 71432db3cbf135225fdb432c380db402a3eeffe7 (patch) | |
tree | eca25ee9bd6dd44ae9613845d22773a358950581 /archaeological_operations/tests.py | |
parent | 94f1e5957436a128c1fe8b543f3b2d1ae65093e4 (diff) | |
download | Ishtar-71432db3cbf135225fdb432c380db402a3eeffe7.tar.bz2 Ishtar-71432db3cbf135225fdb432c380db402a3eeffe7.zip |
Search: manage exclude - refactor search (refs #4180)
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index f67ce5adc..4a27660d0 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1542,6 +1542,12 @@ class OperationSearchTest(TestCase, OperationInitTest): result = json.loads(response.content) self.assertEqual(result['recordsTotal'], 3) + # exclude + response = c.get(reverse('get-operation'), + {'search_vector': '-fougere'}) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 1) + def test_facet_search_vector(self): ope1 = self.operations[0] ope2 = self.operations[1] @@ -1577,6 +1583,13 @@ class OperationSearchTest(TestCase, OperationInitTest): result = json.loads(response.content) self.assertEqual(result['recordsTotal'], 2) + # exclude + search = {'search_vector': u'-{}="{}"'.format(search_q, neo.label)} + response = c.get(reverse('get-operation'), search) + self.assertEqual(response.status_code, 200) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 1) + # OR search = {'search_vector': u'{}="{}";"{}"'.format(search_q, neo.label, gallo.label)} @@ -1585,6 +1598,14 @@ class OperationSearchTest(TestCase, OperationInitTest): result = json.loads(response.content) self.assertEqual(result['recordsTotal'], 3) + # OR - alt syntax + search = {'search_vector': u'{}="{}" {}="{}"'.format( + search_q, neo.label, search_q, gallo.label)} + response = c.get(reverse('get-operation'), search) + self.assertEqual(response.status_code, 200) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 3) + # open search '*' search = {'search_vector': u'{}="{}*"'.format(search_q, neo.label[:3])} response = c.get(reverse('get-operation'), search) |