Return attachment id in api response to attachment upload (#23566).

Patch by Jan Schulz-Hofen.

git-svn-id: http://svn.redmine.org/redmine/trunk@15762 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-08-30 21:15:13 +00:00
parent 942b85e441
commit baaa15ebdd
2 changed files with 4 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
api.upload do
api.id @attachment.id
api.token @attachment.token
end

View File

@@ -111,9 +111,12 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
assert_kind_of Hash, xml['upload']
token = xml['upload']['token']
assert_not_nil token
attachment_id = xml['upload']['id']
assert_not_nil attachment_id
attachment = Attachment.order('id DESC').first
assert_equal token, attachment.token
assert_equal attachment_id, attachment.id.to_s
assert_nil attachment.container
assert_equal 2, attachment.author_id
assert_equal 'File content'.size, attachment.filesize