Mercurial > hg > soundsoftware-site
diff test/integration/api_test/issue_categories_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/test/integration/api_test/issue_categories_test.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/test/integration/api_test/issue_categories_test.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -30,7 +30,7 @@ context "GET /projects/:project_id/issue_categories.xml" do should "return issue categories" do - get '/projects/1/issue_categories.xml', {}, :authorization => credentials('jsmith') + get '/projects/1/issue_categories.xml', {}, credentials('jsmith') assert_response :success assert_equal 'application/xml', @response.content_type assert_tag :tag => 'issue_categories', @@ -40,7 +40,7 @@ context "GET /issue_categories/2.xml" do should "return requested issue category" do - get '/issue_categories/2.xml', {}, :authorization => credentials('jsmith') + get '/issue_categories/2.xml', {}, credentials('jsmith') assert_response :success assert_equal 'application/xml', @response.content_type assert_tag :tag => 'issue_category', @@ -51,7 +51,7 @@ context "POST /projects/:project_id/issue_categories.xml" do should "return create issue category" do assert_difference 'IssueCategory.count' do - post '/projects/1/issue_categories.xml', {:issue_category => {:name => 'API'}}, :authorization => credentials('jsmith') + post '/projects/1/issue_categories.xml', {:issue_category => {:name => 'API'}}, credentials('jsmith') end assert_response :created assert_equal 'application/xml', @response.content_type @@ -64,7 +64,7 @@ context "with invalid parameters" do should "return errors" do assert_no_difference 'IssueCategory.count' do - post '/projects/1/issue_categories.xml', {:issue_category => {:name => ''}}, :authorization => credentials('jsmith') + post '/projects/1/issue_categories.xml', {:issue_category => {:name => ''}}, credentials('jsmith') end assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type @@ -78,9 +78,10 @@ context "with valid parameters" do should "update issue category" do assert_no_difference 'IssueCategory.count' do - put '/issue_categories/2.xml', {:issue_category => {:name => 'API Update'}}, :authorization => credentials('jsmith') + put '/issue_categories/2.xml', {:issue_category => {:name => 'API Update'}}, credentials('jsmith') end assert_response :ok + assert_equal '', @response.body assert_equal 'API Update', IssueCategory.find(2).name end end @@ -88,7 +89,7 @@ context "with invalid parameters" do should "return errors" do assert_no_difference 'IssueCategory.count' do - put '/issue_categories/2.xml', {:issue_category => {:name => ''}}, :authorization => credentials('jsmith') + put '/issue_categories/2.xml', {:issue_category => {:name => ''}}, credentials('jsmith') end assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type @@ -101,9 +102,10 @@ context "DELETE /issue_categories/1.xml" do should "destroy issue categories" do assert_difference 'IssueCategory.count', -1 do - delete '/issue_categories/1.xml', {}, :authorization => credentials('jsmith') + delete '/issue_categories/1.xml', {}, credentials('jsmith') end assert_response :ok + assert_equal '', @response.body assert_nil IssueCategory.find_by_id(1) end @@ -113,15 +115,12 @@ assert_difference 'IssueCategory.count', -1 do assert_difference 'Issue.count(:conditions => {:category_id => 2})', 3 do - delete '/issue_categories/1.xml', {:reassign_to_id => 2}, :authorization => credentials('jsmith') + delete '/issue_categories/1.xml', {:reassign_to_id => 2}, credentials('jsmith') end end assert_response :ok + assert_equal '', @response.body assert_nil IssueCategory.find_by_id(1) end end - - def credentials(user, password=nil) - ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) - end end