diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index ae012840f..cd1f6ac6d 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -4500,7 +4500,7 @@ class ApiTest(OperationInitTest, APITestCase): self.api_user.save() def test_api_search(self): - self.create_api_search_model() + api_search_model = self.create_api_search_model() url = reverse("api-search-operation") data = { "submited": 1, @@ -4514,6 +4514,17 @@ class ApiTest(OperationInitTest, APITestCase): j = json.loads(response.content.decode()) self.assertEqual(j['recordsTotal'], 2) # test default filter + search_code_q = str(pgettext("key for text search", "patriarche")) + api_search_model.limit_query = '{}="28124"'.format(search_code_q) + api_search_model.save() + response = self.client.get( + url, format="json", HTTP_AUTHORIZATION=self.auth_token, + data=data + ) + self.assertEqual(response.status_code, 200) + j = json.loads(response.content.decode()) + self.assertEqual(j['recordsTotal'], 1, "api search limitation not effective") + def test_query_transformation(self): # change query terms from a source Ishtar to match distant Ishtar |