diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 8fe1d8850..4f9f73a43 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1269,6 +1269,24 @@ class OperationSearchTest(TestCase, OperationInitTest): result = json.loads(response.content) self.assertEqual(result['recordsTotal'], 2) + def test_search_vector(self): + c = Client() + response = c.get(reverse('get-operation'), {'year': '2010'}) + # no result when no authentication + self.assertTrue(not json.loads(response.content)) + c.login(username=self.username, password=self.password) + # test vector search with accents + operation = models.Operation.objects.get(pk=self.operations[0].pk) + operation.common_name = u"Opération : Château de Fougères" + operation.save() + response = c.get(reverse('get-operation'), {'search_vector': 'chaTEAU'}) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 1) + response = c.get(reverse('get-operation'), {'search_vector': 'château'}) + result = json.loads(response.content) + self.assertEqual(result['recordsTotal'], 1) + + def create_relations(self): rel1 = models.RelationType.objects.create( symmetrical=True, label='Include', txt_idx='include') |