From ba24111f03c601458f2ede5447c57fc7b22e6246 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 13 Oct 2021 05:22:06 +0200 Subject: Syndication: query string limitation for external source --- archaeological_operations/tests.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'archaeological_operations/tests.py') 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 -- cgit v1.2.3