diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-28 23:23:26 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:20:59 +0100 | 
| commit | db6f3f2152bfb480915a63ae04e88f2979d23341 (patch) | |
| tree | 5632d4e651df050c97c33574327e40448cdcd721 /archaeological_operations/tests.py | |
| parent | 183c1422d978e2b1cbb1d47e0a024dcee57ae3f9 (diff) | |
| download | Ishtar-db6f3f2152bfb480915a63ae04e88f2979d23341.tar.bz2 Ishtar-db6f3f2152bfb480915a63ae04e88f2979d23341.zip  | |
Syndication - search interface
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 33 | 
1 files changed, 31 insertions, 2 deletions
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  | 
