1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-08 16:41:31 +00:00

Add attachment information to issues.xml in REST API (#12181).

git-svn-id: http://svn.redmine.org/redmine/trunk@16360 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-03-03 17:18:58 +00:00
parent 3faa3693d1
commit 331c1f674d
2 changed files with 22 additions and 0 deletions

View File

@ -26,6 +26,12 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l
api.updated_on issue.updated_on
api.closed_on issue.closed_on
api.array :attachments do
issue.attachments.each do |attachment|
render_api_attachment(attachment, api)
end
end if include_in_api_response?('attachments')
api.array :relations do
issue.relations.each do |relation|
api.relation(:id => relation.id, :issue_id => relation.issue_from_id, :issue_to_id => relation.issue_to_id, :relation_type => relation.relation_type, :delay => relation.delay)

View File

@ -82,6 +82,22 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
end
end
test "GET /issues.xml with attachments" do
get '/issues.xml?include=attachments'
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_select 'issue id', :text => '3' do
assert_select '~ attachments attachment', 4
end
assert_select 'issue id', :text => '1' do
assert_select '~ attachments'
assert_select '~ attachments attachment', 0
end
end
test "GET /issues.xml with invalid query params" do
get '/issues.xml', {:f => ['start_date'], :op => {:start_date => '='}}