diff --git a/app/views/wiki/show.api.rsb b/app/views/wiki/show.api.rsb index acf62bb94..2f0690187 100644 --- a/app/views/wiki/show.api.rsb +++ b/app/views/wiki/show.api.rsb @@ -8,4 +8,10 @@ api.wiki_page do api.author(:id => @content.author_id, :name => @content.author.name) api.created_on @page.created_on api.updated_on @content.updated_on + + api.array :attachments do + @page.attachments.each do |attachment| + render_api_attachment(attachment, api) + end + end if include_in_api_response?('attachments') end diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb index 828e139ea..ac4f132e0 100644 --- a/test/integration/api_test/wiki_pages_test.rb +++ b/test/integration/api_test/wiki_pages_test.rb @@ -59,6 +59,21 @@ class ApiTest::WikiPagesTest < ActionController::IntegrationTest end end + test "GET /projects/:project_id/wiki/:title.xml?include=attachments should include attachments" do + get '/projects/ecookbook/wiki/Page_with_an_inline_image.xml?include=attachments' + assert_response 200 + assert_equal 'application/xml', response.content_type + assert_select 'wiki_page' do + assert_select 'title', :text => 'Page_with_an_inline_image' + assert_select 'attachments[type=array]' do + assert_select 'attachment' do + assert_select 'id', :text => '3' + assert_select 'filename', :text => 'logo.gif' + end + end + end + end + test "GET /projects/:project_id/wiki/:title.xml with unknown title and edit permission should respond with 404" do get '/projects/ecookbook/wiki/Invalid_Page.xml', {}, credentials('jsmith') assert_response 404