mirror of
https://github.com/redmine/redmine.git
synced 2025-11-09 14:56:01 +01:00
Test for r18091 (#26237).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18092 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1
test/fixtures/versions.yml
vendored
1
test/fixtures/versions.yml
vendored
@@ -19,6 +19,7 @@ versions_002:
|
|||||||
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
|
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
|
||||||
status: locked
|
status: locked
|
||||||
sharing: 'none'
|
sharing: 'none'
|
||||||
|
wiki_page_title: ECookBookV1
|
||||||
versions_003:
|
versions_003:
|
||||||
created_on: 2006-07-19 21:00:33 +02:00
|
created_on: 2006-07-19 21:00:33 +02:00
|
||||||
name: "2.0"
|
name: "2.0"
|
||||||
|
|||||||
@@ -71,6 +71,22 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
|
|||||||
assert_select 'version id', :text => version.id.to_s
|
assert_select 'version id', :text => version.id.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "POST /projects/:project_id/versions.xml should create the version with wiki page title" do
|
||||||
|
assert_difference 'Version.count' do
|
||||||
|
post '/projects/1/versions.xml',
|
||||||
|
:params => {:version => {:name => 'API test', :wiki_page_title => WikiPage.first.title}},
|
||||||
|
:headers => credentials('jsmith')
|
||||||
|
end
|
||||||
|
|
||||||
|
version = Version.order('id DESC').first
|
||||||
|
assert_equal 'API test', version.name
|
||||||
|
assert_equal WikiPage.first, version.wiki_page
|
||||||
|
|
||||||
|
assert_response :created
|
||||||
|
assert_equal 'application/xml', @response.content_type
|
||||||
|
assert_select 'version id', :text => version.id.to_s
|
||||||
|
end
|
||||||
|
|
||||||
test "POST /projects/:project_id/versions.xml should create the version with custom fields" do
|
test "POST /projects/:project_id/versions.xml should create the version with custom fields" do
|
||||||
field = VersionCustomField.generate!
|
field = VersionCustomField.generate!
|
||||||
|
|
||||||
@@ -116,17 +132,19 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
|
|||||||
assert_select 'id', :text => '2'
|
assert_select 'id', :text => '2'
|
||||||
assert_select 'name', :text => '1.0'
|
assert_select 'name', :text => '1.0'
|
||||||
assert_select 'sharing', :text => 'none'
|
assert_select 'sharing', :text => 'none'
|
||||||
|
assert_select 'wiki_page_title', :text => 'ECookBookV1'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PUT /versions/:id.xml should update the version" do
|
test "PUT /versions/:id.xml should update the version" do
|
||||||
put '/versions/2.xml',
|
put '/versions/2.xml',
|
||||||
:params => {:version => {:name => 'API update'}},
|
:params => {:version => {:name => 'API update', :wiki_page_title => WikiPage.first.title}},
|
||||||
:headers => credentials('jsmith')
|
:headers => credentials('jsmith')
|
||||||
|
|
||||||
assert_response :no_content
|
assert_response :no_content
|
||||||
assert_equal '', @response.body
|
assert_equal '', @response.body
|
||||||
assert_equal 'API update', Version.find(2).name
|
assert_equal 'API update', Version.find(2).name
|
||||||
|
assert_equal WikiPage.first, Version.find(2).wiki_page
|
||||||
end
|
end
|
||||||
|
|
||||||
test "DELETE /versions/:id.xml should destroy the version" do
|
test "DELETE /versions/:id.xml should destroy the version" do
|
||||||
|
|||||||
Reference in New Issue
Block a user