summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 16:26:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 16:26:13 +0000
commit8458faed11117bd93a0c53eea8cdfb687952bb09 (patch)
tree7b88319392cfa97ed28af50519df9c0b638f32a1 /test/integration
parentd24e66370bf7b3af731f3cc238ced64e2bb8d3f2 (diff)
downloadredmine-8458faed11117bd93a0c53eea8cdfb687952bb09.tar.gz
redmine-8458faed11117bd93a0c53eea8cdfb687952bb09.zip
Accept key auth for ProjectsController#create (#6841).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4441 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/projects_test.rb33
1 files changed, 19 insertions, 14 deletions
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index 21b080a13..d898b42ac 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -46,21 +46,26 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
assert_equal 'application/xml', @response.content_type
assert_no_tag 'custom_field', :attributes => {:name => 'Development status'}
end
-
- def test_create
- attributes = {:name => 'API test', :identifier => 'api-test'}
- assert_difference 'Project.count' do
- post '/projects.xml', {:project => attributes}, :authorization => credentials('admin')
- end
-
- project = Project.first(:order => 'id DESC')
- attributes.each do |attribute, value|
- assert_equal value, project.send(attribute)
- end
+
+ context "POST /projects.xml" do
+ should_allow_api_authentication(:post,
+ '/projects.xml',
+ {:project => {:name => 'API test', :identifier => 'api-test'}},
+ {:success_code => :created})
- assert_response :created
- assert_equal 'application/xml', @response.content_type
- assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s}
+ should "create a project with the attributes" do
+ assert_difference('Project.count') do
+ post '/projects.xml', {:project => {:name => 'API test', :identifier => 'api-test'}}, :authorization => credentials('admin')
+ end
+
+ project = Project.first(:order => 'id DESC')
+ assert_equal 'API test', project.name
+ assert_equal 'api-test', project.identifier
+
+ assert_response :created
+ assert_equal 'application/xml', @response.content_type
+ assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s}
+ end
end
def test_create_failure