diff options
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() | 
