From caaea9c1f7f6702203ee947ca23a43c3ef5732fd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 28 Oct 2021 23:23:26 +0200 Subject: Syndication - search interface --- archaeological_operations/tests.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'archaeological_operations/tests.py') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 69d3e7f26..36e786f35 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -4753,11 +4753,39 @@ class ApiTest(OperationInitTest, APITestCase): ) msg = str(_(f"{sheet_name} is not a correct sheet name.")) self.assertIn(msg, response) + # TODO: mark with no update - def test_query_transformation(self): + @patch("requests.get") + def test_query_transformation(self, mock_get): # POV: local # change query terms from a source Ishtar to match distant Ishtar - pass + self._mock_request(mock_get) + self.client.login(username=self.username, password=self.password) + source = self._get_source() + + url = "/admin/{}/{}/".format( + "ishtar_common", models_rest.ApiExternalSource.__name__.lower() + ) + params = { + "action": "update_types_from_source", + "_selected_action": [source.pk], + } + self.client.post(url, params, follow=True) + # change a key match + content_type = ContentType.objects.get_for_model(models.Period) + # no republic for local + models_rest.ApiKeyMatch.objects.get( + source=source, associated_type=content_type, + distant_key="republic" + ).delete() + # local have only neolithic period no detail + keys = ("old-neolithic", "middle-neolithic", "recent-neolithic", + "final-neolithic") + models_rest.ApiKeyMatch.objects.filter( + source=source, associated_type=content_type, + distant_key__in=keys).update( + local_slug="neolithic", local_label="Néolithique") + def test_external_source_query(self): # POV: local @@ -4767,5 +4795,6 @@ class ApiTest(OperationInitTest, APITestCase): pass def test_distant_sheet_display(self): + # POV: local # test query limitation pass -- cgit v1.2.3