diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-20 16:20:31 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-20 16:20:31 +0100 | 
| commit | 3aafd91d3b5dafc0603d4c8edf80173a82535d6a (patch) | |
| tree | 59e6ee0433f382077412881957ab84a3d8278467 /archaeological_operations/tests.py | |
| parent | bc2584a753e93031475afd03d839a6d8316cfc84 (diff) | |
| download | Ishtar-3aafd91d3b5dafc0603d4c8edf80173a82535d6a.tar.bz2 Ishtar-3aafd91d3b5dafc0603d4c8edf80173a82535d6a.zip | |
Fix unaccented search in search vector (refs #3152)
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') | 
