From 7bfb6145562e99832b5d289ee12268c995fe95ce Mon Sep 17 00:00:00 2001 From: MJedr Date: Tue, 24 Oct 2023 16:59:56 +0200 Subject: [PATCH] add ticket_url to extra_data --- .github/workflows/backend-tests-on-docker.yml | 3 ++- inspirehep/modules/workflows/tasks/submission.py | 4 +++- tests/integration/workflows/test_workflow_tasks_submission.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backend-tests-on-docker.yml b/.github/workflows/backend-tests-on-docker.yml index 1a4099dfc1..0fe3091cf9 100644 --- a/.github/workflows/backend-tests-on-docker.yml +++ b/.github/workflows/backend-tests-on-docker.yml @@ -73,7 +73,8 @@ jobs: --ignore tests/integration/workflows/test_workflows_tasks_upload.py \ --ignore tests/integration/workflows/test_arxiv_workflow.py \ --ignore tests/integration/workflows/test_edit_article.py \ - --ignore tests/integration/workflows/test_views.py + --ignore tests/integration/workflows/test_views.py \ + --ignore tests/integration/workflows/test_workflow_tasks_submission Workflows-II: runs-on: ubuntu-latest diff --git a/inspirehep/modules/workflows/tasks/submission.py b/inspirehep/modules/workflows/tasks/submission.py index a416963679..1eeab9468b 100644 --- a/inspirehep/modules/workflows/tasks/submission.py +++ b/inspirehep/modules/workflows/tasks/submission.py @@ -95,9 +95,11 @@ def submit_snow_ticket(obj, queue, template, context, caller, recid, ticket_id_k data=json.dumps(ticket_payload), ) response.raise_for_status() - ticket_id = response.json()["ticket_id"] + response_json = response.json() + ticket_id = response_json["ticket_id"] obj.extra_data[ticket_id_key] = ticket_id + obj.extra_data["ticket_url"] = response_json["ticket_url"] obj.log.info("Ticket {0} created".format(ticket_id)) return ticket_id diff --git a/tests/integration/workflows/test_workflow_tasks_submission.py b/tests/integration/workflows/test_workflow_tasks_submission.py index 1d65e4b08a..59153325e6 100644 --- a/tests/integration/workflows/test_workflow_tasks_submission.py +++ b/tests/integration/workflows/test_workflow_tasks_submission.py @@ -104,7 +104,7 @@ def test_create_ticket_calls_tickets_create_with_template(workflow_app): request_mocker.register_uri( "POST", "http://web:8000/tickets/create-with-template", - json={"ticket_id": "123"}, + json={"ticket_id": "123", "ticket_url": "http//test.com/1"}, headers=_get_headers_for_hep_root_table_request(), status_code=200, )