Skip to content

Commit

Permalink
Merge pull request #4052 from freedomofpress/api-add-filename
Browse files Browse the repository at this point in the history
Adds "filename" to reply creation API response
  • Loading branch information
kushaldas authored Jan 22, 2019
2 parents b725c81 + 088db23 commit 23378ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 23378ed

Please sign in to comment.