Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
user actions: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Jul 17, 2024
1 parent ddb48c3 commit 76602b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .envs/local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 4 additions & 13 deletions backoffice/workflows/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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",
Expand Down

0 comments on commit 76602b2

Please sign in to comment.