From 617df54cd214919097a0a66f50f2b4597e1ed21c Mon Sep 17 00:00:00 2001 From: MJedr Date: Thu, 19 Oct 2023 16:11:07 +0200 Subject: [PATCH] reply snow ticket: add user email to request payload --- inspirehep/modules/workflows/tasks/submission.py | 7 ++++++- .../workflows/test_workflow_tasks_submission.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/inspirehep/modules/workflows/tasks/submission.py b/inspirehep/modules/workflows/tasks/submission.py index 84d65a681c..a416963679 100644 --- a/inspirehep/modules/workflows/tasks/submission.py +++ b/inspirehep/modules/workflows/tasks/submission.py @@ -161,7 +161,11 @@ def reply_snow_ticket(obj, ticket_id, context_factory, user, template=None): ), headers=_get_headers_for_hep_root_table_request(), data=json.dumps( - {"ticket_id": str(ticket_id), "reply_message": reply_message} + { + "ticket_id": str(ticket_id), + "reply_message": reply_message, + "user_email": user.email + } ), ) response.raise_for_status() @@ -178,6 +182,7 @@ def reply_snow_ticket(obj, ticket_id, context_factory, user, template=None): "ticket_id": str(ticket_id), "template": template, "template_context": template_context, + "user_email": user.email } ), ) diff --git a/tests/integration/workflows/test_workflow_tasks_submission.py b/tests/integration/workflows/test_workflow_tasks_submission.py index 0d83958d3b..1d65e4b08a 100644 --- a/tests/integration/workflows/test_workflow_tasks_submission.py +++ b/tests/integration/workflows/test_workflow_tasks_submission.py @@ -37,7 +37,7 @@ def test_reply_ticket_calls_tickets_reply_when_template_is_not_set(workflow_app) assert expected_result == result assert ( request_mocker.request_history[0]._request.body - == '{"ticket_id": "1", "reply_message": "reply reason"}' + == '{"ticket_id": "1", "user_email": "admin@inspirehep.net", "reply_message": "reply reason"}' ) @@ -68,7 +68,7 @@ def test_reply_ticket_calls_tickets_reply_when_template_is_set(workflow_app): assert expected_result == result assert ( request_mocker.request_history[0]._request.body - == '{"template_context": {"reason": "", "record_url": "", "user_name": "admin@inspirehep.net", "title": "Partial Symmetries of Weak Interactions"}, "ticket_id": "1", "template": "test"}' + == '{"user_email": "admin@inspirehep.net", "template_context": {"reason": "", "record_url": "", "user_name": "admin@inspirehep.net", "title": "Partial Symmetries of Weak Interactions"}, "ticket_id": "1", "template": "test"}' )