From 088db23093cf5bb99fe0c7404178111236880e14 Mon Sep 17 00:00:00 2001 From: heartsucker Date: Mon, 21 Jan 2019 17:19:29 +0100 Subject: [PATCH] added "filename" to reply creation api response --- securedrop/journalist_app/api.py | 3 ++- securedrop/tests/test_journalist_api.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/securedrop/journalist_app/api.py b/securedrop/journalist_app/api.py index fe3b4e3686..221cb028ab 100644 --- a/securedrop/journalist_app/api.py +++ b/securedrop/journalist_app/api.py @@ -267,7 +267,8 @@ def all_source_replies(source_uuid): raise e return jsonify({'message': 'Your reply has been stored', - 'uuid': reply.uuid}), 201 + 'uuid': reply.uuid, + 'filename': reply.filename}), 201 @api.route('/sources//replies/', methods=['GET', 'DELETE']) diff --git a/securedrop/tests/test_journalist_api.py b/securedrop/tests/test_journalist_api.py index c89a92424d..acc03b2c53 100644 --- a/securedrop/tests/test_journalist_api.py +++ b/securedrop/tests/test_journalist_api.py @@ -652,6 +652,9 @@ def test_authorized_user_can_add_reply(journalist_app, journalist_api_token, reply = Reply.query.filter_by(uuid=str(reply_uuid)).one_or_none() assert reply is not None + # check that the filename is present and correct (#4047) + assert response.json['filename'] == reply.filename + with journalist_app.app_context(): # Now verify everything was saved. assert reply.journalist_id == test_journo['id'] assert reply.source_id == source_id