##// END OF EJS Templates
Adds ?include=attachments option when retrieving a wiki page with the REST API (#7082)....
Jean-Philippe Lang -
r10506:03062394fcad
parent child
Show More
@@ -8,4 +8,10 api.wiki_page do
8 api.author(:id => @content.author_id, :name => @content.author.name)
8 api.author(:id => @content.author_id, :name => @content.author.name)
9 api.created_on @page.created_on
9 api.created_on @page.created_on
10 api.updated_on @content.updated_on
10 api.updated_on @content.updated_on
11
12 api.array :attachments do
13 @page.attachments.each do |attachment|
14 render_api_attachment(attachment, api)
15 end
16 end if include_in_api_response?('attachments')
11 end
17 end
@@ -59,6 +59,21 class ApiTest::WikiPagesTest < ActionController::IntegrationTest
59 end
59 end
60 end
60 end
61
61
62 test "GET /projects/:project_id/wiki/:title.xml?include=attachments should include attachments" do
63 get '/projects/ecookbook/wiki/Page_with_an_inline_image.xml?include=attachments'
64 assert_response 200
65 assert_equal 'application/xml', response.content_type
66 assert_select 'wiki_page' do
67 assert_select 'title', :text => 'Page_with_an_inline_image'
68 assert_select 'attachments[type=array]' do
69 assert_select 'attachment' do
70 assert_select 'id', :text => '3'
71 assert_select 'filename', :text => 'logo.gif'
72 end
73 end
74 end
75 end
76
62 test "GET /projects/:project_id/wiki/:title.xml with unknown title and edit permission should respond with 404" do
77 test "GET /projects/:project_id/wiki/:title.xml with unknown title and edit permission should respond with 404" do
63 get '/projects/ecookbook/wiki/Invalid_Page.xml', {}, credentials('jsmith')
78 get '/projects/ecookbook/wiki/Invalid_Page.xml', {}, credentials('jsmith')
64 assert_response 404
79 assert_response 404
General Comments 0
You need to be logged in to leave comments. Login now