Commit 566015e5 authored by jplang's avatar jplang

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

git-svn-id: https://svn.redmine.org/redmine/trunk@16360 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 9bb86c44
......@@ -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)
......
......@@ -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 => '='}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment