From 76602b23afc71336c35b815c9fea5a8ba3c7bbd3 Mon Sep 17 00:00:00 2001 From: DonHaul Date: Wed, 17 Jul 2024 10:10:54 +0200 Subject: [PATCH] user actions: testing --- .envs/local/.django | 2 +- backoffice/workflows/tests/test_views.py | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.envs/local/.django b/.envs/local/.django index 8507aa5d..6674841e 100644 --- a/.envs/local/.django +++ b/.envs/local/.django @@ -19,5 +19,5 @@ OPENSEARCH_HOST=opensearch:9200 OPENSEARCH_INDEX_PREFIX=backoffice-backend-local # Airflow -AIRFLOW_BASE_URL=http://host.docker.internal:8080 +AIRFLOW_BASE_URL=http://host.docker.internal:8082 AIRFLOW_TOKEN=CHANGE_ME diff --git a/backoffice/workflows/tests/test_views.py b/backoffice/workflows/tests/test_views.py index f9683ecc..a1cdd960 100644 --- a/backoffice/workflows/tests/test_views.py +++ b/backoffice/workflows/tests/test_views.py @@ -12,10 +12,10 @@ from backoffice.workflows.api.serializers import WorkflowTicketSerializer from backoffice.workflows.constants import StatusChoices +from backoffice.workflows.models import WorkflowTicket User = get_user_model() Workflow = apps.get_model(app_label="workflows", model_name="Workflow") -WorkflowTicket = apps.get_model(app_label="workflows", model_name="WorkflowTicket") class BaseTransactionTestCase(TransactionTestCase): @@ -274,7 +274,7 @@ def test_reject_author(self, mock_post): self.assertEqual(response.status_code, 200) - def test_restart_full_dagrun(self, mock_post): + def test_restart_full_dagrun(self): self.api_client.force_authenticate(user=self.curator) url = reverse( @@ -286,12 +286,7 @@ def test_restart_full_dagrun(self, mock_post): self.assertEqual(response.status_code, 200) - @patch("backoffice.workflows.airflow_utils.requests.post") - def test_restart_a_task(self, mock_post): - - mock_response = mock_post.return_value - mock_response.status_code = status.HTTP_200_OK - mock_response.json.return_value = {"key": "value"} + def test_restart_a_task(self): self.api_client.force_authenticate(user=self.curator) url = reverse( @@ -302,12 +297,8 @@ def test_restart_a_task(self, mock_post): response = self.api_client.post(url, json={"task_ids": ["set_workflow_status_to_running"]}) self.assertEqual(response.status_code, 200) - @patch("backoffice.workflows.airflow_utils.requests.post") - def test_restart_with_params(self, mock_post): + def test_restart_with_params(self): - mock_response = mock_post.return_value - mock_response.status_code = status.HTTP_200_OK - mock_response.json.return_value = {"key": "value"} self.api_client.force_authenticate(user=self.curator) url = reverse( "api:workflows-authors-restart",