Feature #23566 ยป 0001-return-attachment-id-in-api-response-to-attachment-u.patch
| app/views/attachments/upload.api.rsb | ||
|---|---|---|
| 1 | 1 |
api.upload do |
| 2 |
api.id @attachment.id |
|
| 2 | 3 |
api.token @attachment.token |
| 3 | 4 |
end |
| test/integration/api_test/attachments_test.rb | ||
|---|---|---|
| 111 | 111 |
assert_kind_of Hash, xml['upload'] |
| 112 | 112 |
token = xml['upload']['token'] |
| 113 | 113 |
assert_not_nil token |
| 114 |
attachment_id = xml['upload']['id'] |
|
| 115 |
assert_not_nil attachment_id |
|
| 114 | 116 | |
| 115 | 117 |
attachment = Attachment.order('id DESC').first
|
| 116 | 118 |
assert_equal token, attachment.token |
| 119 |
assert_equal attachment_id, attachment.id.to_s |
|
| 117 | 120 |
assert_nil attachment.container |
| 118 | 121 |
assert_equal 2, attachment.author_id |
| 119 | 122 |
assert_equal 'File content'.size, attachment.filesize |