Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added "filename" to reply creation api response #4052

Merged
merged 1 commit into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion securedrop/journalist_app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<source_uuid>/replies/<reply_uuid>',
methods=['GET', 'DELETE'])
Expand Down
3 changes: 3 additions & 0 deletions securedrop/tests/test_journalist_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down