diff options
-rw-r--r-- | test/integration/api_test/projects_test.rb | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index cd336c51c..befd8907d 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -188,9 +188,11 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "POST /projects.xml with valid parameters should create the project" do with_settings :default_projects_modules => ['issue_tracking', 'repository'] do assert_difference('Project.count') do - post '/projects.xml', + post( + '/projects.xml', :params => {:project => {:name => 'API test', :identifier => 'api-test'}}, :headers => credentials('admin') + ) end end @@ -207,9 +209,17 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "POST /projects.xml should accept enabled_module_names attribute" do assert_difference('Project.count') do - post '/projects.xml', - :params => {:project => {:name => 'API test', :identifier => 'api-test', :enabled_module_names => ['issue_tracking', 'news', 'time_tracking']}}, + post( + '/projects.xml', + :params => { + :project => { + :name => 'API test', + :identifier => 'api-test', + :enabled_module_names => ['issue_tracking', 'news', 'time_tracking'] + } + }, :headers => credentials('admin') + ) end project = Project.order('id DESC').first @@ -218,9 +228,17 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "POST /projects.xml should accept tracker_ids attribute" do assert_difference('Project.count') do - post '/projects.xml', - :params => {:project => {:name => 'API test', :identifier => 'api-test', :tracker_ids => [1, 3]}}, + post( + '/projects.xml', + :params => { + :project => { + :name => 'API test', + :identifier => 'api-test', + :tracker_ids => [1, 3] + } + }, :headers => credentials('admin') + ) end project = Project.order('id DESC').first @@ -229,9 +247,11 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "POST /projects.xml with invalid parameters should return errors" do assert_no_difference('Project.count') do - post '/projects.xml', + post( + '/projects.xml', :params => {:project => {:name => 'API test'}}, :headers => credentials('admin') + ) end assert_response :unprocessable_entity @@ -241,9 +261,11 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "PUT /projects/:id.xml with valid parameters should update the project" do assert_no_difference 'Project.count' do - put '/projects/2.xml', + put( + '/projects/2.xml', :params => {:project => {:name => 'API update'}}, :headers => credentials('jsmith') + ) end assert_response :no_content assert_equal '', @response.body @@ -254,9 +276,16 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "PUT /projects/:id.xml should accept enabled_module_names attribute" do assert_no_difference 'Project.count' do - put '/projects/2.xml', - :params => {:project => {:name => 'API update', :enabled_module_names => ['issue_tracking', 'news', 'time_tracking']}}, + put( + '/projects/2.xml', + :params => { + :project => { + :name => 'API update', + :enabled_module_names => ['issue_tracking', 'news', 'time_tracking'] + } + }, :headers => credentials('admin') + ) end assert_response :no_content assert_equal '', @response.body @@ -266,9 +295,11 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "PUT /projects/:id.xml should accept tracker_ids attribute" do assert_no_difference 'Project.count' do - put '/projects/2.xml', + put( + '/projects/2.xml', :params => {:project => {:name => 'API update', :tracker_ids => [1, 3]}}, :headers => credentials('admin') + ) end assert_response :no_content assert_equal '', @response.body @@ -278,9 +309,11 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "PUT /projects/:id.xml with invalid parameters should return errors" do assert_no_difference('Project.count') do - put '/projects/2.xml', + put( + '/projects/2.xml', :params => {:project => {:name => ''}}, :headers => credentials('admin') + ) end assert_response :unprocessable_entity |