Browse Source

Test for r18091 (#26237).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@18092 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Go MAEDA 5 years ago
parent
commit
2a80dbfb76
2 changed files with 20 additions and 1 deletions
  1. 1
    0
      test/fixtures/versions.yml
  2. 19
    1
      test/integration/api_test/versions_test.rb

+ 1
- 0
test/fixtures/versions.yml View File

@@ -19,6 +19,7 @@ versions_002:
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
status: locked
sharing: 'none'
wiki_page_title: ECookBookV1
versions_003:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"

+ 19
- 1
test/integration/api_test/versions_test.rb View File

@@ -71,6 +71,22 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
assert_select 'version id', :text => version.id.to_s
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
field = VersionCustomField.generate!

@@ -116,17 +132,19 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
assert_select 'id', :text => '2'
assert_select 'name', :text => '1.0'
assert_select 'sharing', :text => 'none'
assert_select 'wiki_page_title', :text => 'ECookBookV1'
end
end

test "PUT /versions/:id.xml should update the version" do
put '/versions/2.xml',
:params => {:version => {:name => 'API update'}},
:params => {:version => {:name => 'API update', :wiki_page_title => WikiPage.first.title}},
:headers => credentials('jsmith')

assert_response :no_content
assert_equal '', @response.body
assert_equal 'API update', Version.find(2).name
assert_equal WikiPage.first, Version.find(2).wiki_page
end

test "DELETE /versions/:id.xml should destroy the version" do

Loading…
Cancel
Save