summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py33
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