summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-16 06:29:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-16 06:29:52 +0000
commit7d6b3d344db870e1417fc5a08413729b60e7ce77 (patch)
tree444cc95a1754fce8bb4554a11e23f5d978346f35 /test
parent0e59482e90a788f2da7775a3fb5c51dbea7b135f (diff)
downloadredmine-7d6b3d344db870e1417fc5a08413729b60e7ce77.tar.gz
redmine-7d6b3d344db870e1417fc5a08413729b60e7ce77.zip
Add support for attaching file to WIKI pages by REST API (#14830).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@15415 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/integration/api_test/wiki_pages_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb
index 9a091e781..51e132eda 100644
--- a/test/integration/api_test/wiki_pages_test.rb
+++ b/test/integration/api_test/wiki_pages_test.rb
@@ -164,6 +164,25 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
assert_nil page.parent
end
+ test "PUT /projects/:project_id/wiki/:title.xml with attachment" do
+ set_tmp_attachments_directory
+ attachment = Attachment.create!(:file => uploaded_test_file("testfile.txt", "text/plain"), :author_id => 2)
+ assert_difference 'WikiPage.count' do
+ assert_difference 'WikiContent::Version.count' do
+ put '/projects/ecookbook/wiki/New_page_from_API.xml',
+ {:wiki_page => {:text => 'New content from API with Attachments', :comments => 'API create with Attachments',
+ :uploads => [:token => attachment.token, :filename => 'testfile.txt', :content_type => "text/plain"]}},
+ credentials('jsmith')
+ assert_response 201
+ end
+ end
+
+ page = WikiPage.order('id DESC').first
+ assert_equal 'New_page_from_API', page.title
+ assert_include attachment, page.attachments
+ assert_equal attachment.filename, page.attachments.first.filename
+ end
+
test "PUT /projects/:project_id/wiki/:title.xml with parent" do
assert_difference 'WikiPage.count' do
assert_difference 'WikiContent::Version.count' do