diff options
Diffstat (limited to 'test/integration')
22 files changed, 105 insertions, 105 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index f63c2b057..4a58ccfc0 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -42,7 +42,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/:id.xml should return the attachment" do get '/attachments/7.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'attachment id', :text => '7' do assert_select '~ filename', :text => 'archive.zip' assert_select '~ content_url', :text => 'http://www.example.com/attachments/download/7/archive.zip' @@ -52,7 +52,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/:id.xml for image should include thumbnail_url" do get '/attachments/16.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'attachment id:contains(16)' do assert_select '~ thumbnail_url', :text => 'http://www.example.com/attachments/thumbnail/16' end @@ -66,7 +66,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/download/:id/:filename should return the attachment content" do get '/attachments/download/7/archive.zip', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/zip', @response.content_type + assert_equal 'application/zip', @response.media_type end test "GET /attachments/download/:id/:filename should deny access without credentials" do @@ -104,7 +104,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :no_content - assert_nil response.content_type + assert_nil response.media_type attachment = Attachment.find(7) assert_equal 'renamed.zip', attachment.filename assert_equal 'updated', attachment.description @@ -116,7 +116,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response 422 - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_include "File cannot be blank", json['errors'] end @@ -129,7 +129,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base "CONTENT_TYPE" => 'application/octet-stream' }.merge(credentials('jsmith')) assert_response :created - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end xml = Hash.from_xml(response.body) @@ -160,7 +160,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base "CONTENT_TYPE" => 'application/octet-stream' }.merge(credentials('jsmith')) assert_response :created - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type end json = ActiveSupport::JSON.decode(response.body) diff --git a/test/integration/api_test/custom_fields_test.rb b/test/integration/api_test/custom_fields_test.rb index acdea3949..cf66f2158 100644 --- a/test/integration/api_test/custom_fields_test.rb +++ b/test/integration/api_test/custom_fields_test.rb @@ -25,7 +25,7 @@ class Redmine::ApiTest::CustomFieldsTest < Redmine::ApiTest::Base test "GET /custom_fields.xml should return custom fields" do get '/custom_fields.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'custom_fields' do assert_select 'custom_field' do diff --git a/test/integration/api_test/enumerations_test.rb b/test/integration/api_test/enumerations_test.rb index 05e0e9f7c..a639d38c9 100644 --- a/test/integration/api_test/enumerations_test.rb +++ b/test/integration/api_test/enumerations_test.rb @@ -25,7 +25,7 @@ class Redmine::ApiTest::EnumerationsTest < Redmine::ApiTest::Base test "GET /enumerations/issue_priorities.xml should return priorities" do get '/enumerations/issue_priorities.xml' assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue_priorities[type=array]' do assert_select 'issue_priority:nth-of-type(3)' do assert_select 'id', :text => '6' @@ -43,6 +43,6 @@ class Redmine::ApiTest::EnumerationsTest < Redmine::ApiTest::Base test "GET /enumerations/invalid_subclass.xml should return 404" do get '/enumerations/invalid_subclass.xml' assert_response 404 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end end diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb index 4f3284c1e..bd17a03ca 100644 --- a/test/integration/api_test/groups_test.rb +++ b/test/integration/api_test/groups_test.rb @@ -30,7 +30,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.xml should return givable groups" do get '/groups.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'groups' do assert_select 'group', Group.givable.count @@ -44,7 +44,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.xml?builtin=1 should return all groups" do get '/groups.xml?builtin=1', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'groups' do assert_select 'group', Group.givable.count + 2 @@ -67,7 +67,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.json should return groups" do get '/groups.json', :headers => credentials('admin') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) groups = json['groups'] @@ -80,7 +80,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should return the group" do get '/groups/10.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'name', :text => 'A Team' @@ -91,7 +91,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should return the builtin group" do get '/groups/12.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'builtin', :text => 'non_member' @@ -102,7 +102,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should include users if requested" do get '/groups/10.xml?include=users', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'users' do @@ -115,7 +115,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml include memberships if requested" do get '/groups/10.xml?include=memberships', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'memberships' @@ -128,7 +128,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :params => {:group => {:name => 'Test', :user_ids => [2, 3]}}, :headers => credentials('admin') assert_response :created - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end group = Group.order('id DESC').first @@ -147,7 +147,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :headers => credentials('admin') end assert_response :unprocessable_entity - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'errors' do assert_select 'error', :text => /Name cannot be blank/ @@ -172,7 +172,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :params => {:group => {:name => ''}}, :headers => credentials('admin') assert_response :unprocessable_entity - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'errors' do assert_select 'error', :text => /Name cannot be blank/ diff --git a/test/integration/api_test/issue_categories_test.rb b/test/integration/api_test/issue_categories_test.rb index 52dae6dba..a6b139f55 100644 --- a/test/integration/api_test/issue_categories_test.rb +++ b/test/integration/api_test/issue_categories_test.rb @@ -29,14 +29,14 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/issue_categories.xml should return the issue categories" do get '/projects/1/issue_categories.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories issue_category id', :text => '2' end test "GET /issue_categories/:id.xml should return the issue category" do get '/issue_categories/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_category id', :text => '2' end @@ -48,7 +48,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type category = IssueCategory.order('id DESC').first assert_equal 'API', category.name @@ -63,7 +63,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end @@ -88,7 +88,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end diff --git a/test/integration/api_test/issue_relations_test.rb b/test/integration/api_test/issue_relations_test.rb index fa6c5a546..842f785e2 100644 --- a/test/integration/api_test/issue_relations_test.rb +++ b/test/integration/api_test/issue_relations_test.rb @@ -33,7 +33,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base get '/issues/9/relations.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relations[type=array] relation id', :text => '1' end @@ -51,7 +51,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base assert_equal 'relates', relation.relation_type assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relation id', :text => relation.id.to_s end @@ -70,7 +70,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base get '/relations/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relation id', :text => '2' end diff --git a/test/integration/api_test/issue_statuses_test.rb b/test/integration/api_test/issue_statuses_test.rb index 150324ecf..e685b59b0 100644 --- a/test/integration/api_test/issue_statuses_test.rb +++ b/test/integration/api_test/issue_statuses_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::IssueStatusesTest < Redmine::ApiTest::Base get '/issue_statuses.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_statuses[type=array] issue_status id', :text => '2' do assert_select '~ name', :text => 'Assigned' end diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index ecb77dcf7..f524d8052 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -72,7 +72,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml?include=relations' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue id', :text => '3' do assert_select '~ relations relation', 1 @@ -89,7 +89,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml?include=attachments' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue id', :text => '3' do assert_select '~ attachments attachment', 4 @@ -105,7 +105,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml', :params => {:f => ['start_date'], :op => {:start_date => '='}} assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Start date cannot be blank" end @@ -371,7 +371,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues/1.xml?include=watchers', :headers => credentials('jsmith') assert_response :ok - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'watchers', Issue.find(1).watchers.count assert_select 'watchers' do @@ -402,7 +402,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) get '/issues/3.xml' - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'estimated_hours', parent.estimated_hours.to_s assert_select 'total_estimated_hours', (parent.estimated_hours.to_f + 3.0).to_s @@ -418,7 +418,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base Role.anonymous.remove_permission! :view_time_entries get '/issues/3.xml' - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'estimated_hours', parent.estimated_hours.to_s assert_select 'total_estimated_hours', (parent.estimated_hours.to_f + 3.0).to_s @@ -437,7 +437,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) get '/issues/3.xml', :headers => credentials(user.login) - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'spent_hours', '5.5' assert_select 'total_spent_hours', '7.5' @@ -452,7 +452,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) get '/issues/3.json' - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal parent.estimated_hours, json['issue']['estimated_hours'] assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours'] @@ -467,7 +467,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base Role.anonymous.remove_permission! :view_time_entries get '/issues/3.json' - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal parent.estimated_hours, json['issue']['estimated_hours'] assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours'] @@ -485,7 +485,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) get '/issues/3.json', :headers => credentials(user.login) - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 5.5, json['issue']['spent_hours'] assert_equal 7.5, json['issue']['total_spent_hours'] @@ -516,7 +516,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base assert_equal 'API test', issue.subject assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue > id', :text => issue.id.to_s end diff --git a/test/integration/api_test/memberships_test.rb b/test/integration/api_test/memberships_test.rb index 463ddf9bd..76e0f58ef 100644 --- a/test/integration/api_test/memberships_test.rb +++ b/test/integration/api_test/memberships_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/projects/1/memberships.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'memberships[type=array] membership id', :text => '2' do assert_select '~ user[id="3"][name="Dave Lopper"]' assert_select '~ roles role[id="2"][name=Developer]' @@ -37,7 +37,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/projects/1/memberships.json', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 3, json["total_count"] assert_equal 25, json["limit"] @@ -98,7 +98,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Principal cannot be blank" end end @@ -107,7 +107,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/memberships/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'membership id', :text => '2' do assert_select '~ user[id="3"][name="Dave Lopper"]' assert_select '~ roles role[id="2"][name=Developer]' @@ -118,7 +118,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/memberships/2.json', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal( {"membership" => { @@ -150,7 +150,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Role cannot be empty" end diff --git a/test/integration/api_test/my_test.rb b/test/integration/api_test/my_test.rb index 1749b709a..f53377abd 100644 --- a/test/integration/api_test/my_test.rb +++ b/test/integration/api_test/my_test.rb @@ -27,7 +27,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base get '/my/account.json', :headers => credentials('dlopper', 'foo') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert json.key?('user') assert_equal 'dlopper', json['user']['login'] @@ -82,7 +82,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base }, :headers => credentials('dlopper', 'foo')) assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -96,7 +96,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base }, :headers => credentials('dlopper', 'foo')) assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index 33eae6455..4fa39058d 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.rb @@ -66,7 +66,7 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base test "GET /news/:id.xml" do get "/news/1.xml" assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'news' do assert_select 'id', 1 assert_select "project[id=1][name=\"eCookbook\"]" @@ -81,7 +81,7 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base test "GET /news/:id.json" do get "/news/1.json" assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 1, json['news']['id'] end diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index 6c7496fc4..96185ce38 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -36,7 +36,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'projects>project:first-child' do assert_select '>id', :text => '1' @@ -49,7 +49,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.json should return projects" do get '/projects.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json @@ -62,7 +62,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=issue_categories should return categories" do get '/projects.xml?include=issue_categories' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' end @@ -70,7 +70,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=trackers should return trackers" do get '/projects.xml?include=trackers' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' end @@ -78,7 +78,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=enabled_modules should return enabled modules" do get '/projects.xml?include=enabled_modules' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]' end @@ -88,7 +88,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'project>id', :text => '1' assert_select 'project>status', :text => '1' @@ -115,7 +115,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'custom_field[name=?]', 'Development status', 0 end @@ -123,7 +123,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=issue_categories should return categories" do get '/projects/1.xml?include=issue_categories' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' end @@ -131,7 +131,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=time_entry_activities should return activities" do get '/projects/1.xml?include=time_entry_activities' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry_activities[type=array] time_entry_activity[id="10"][name=Development]' end @@ -139,7 +139,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=trackers should return trackers" do get '/projects/1.xml?include=trackers' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' end @@ -147,7 +147,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=enabled_modules should return enabled modules" do get '/projects/1.xml?include=enabled_modules' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]' end @@ -168,7 +168,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base assert_equal Tracker.all.size, project.trackers.size assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'project id', :text => project.id.to_s end @@ -202,7 +202,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Identifier cannot be blank" end @@ -214,7 +214,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :no_content assert_equal '', @response.body - assert_nil @response.content_type + assert_nil @response.media_type project = Project.find(2) assert_equal 'API update', project.name end @@ -251,7 +251,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end diff --git a/test/integration/api_test/queries_test.rb b/test/integration/api_test/queries_test.rb index c3f743766..5ba21778a 100644 --- a/test/integration/api_test/queries_test.rb +++ b/test/integration/api_test/queries_test.rb @@ -33,7 +33,7 @@ class Redmine::ApiTest::QueriesTest < Redmine::ApiTest::Base get '/queries.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'queries[type=array] query id', :text => '4' do assert_select '~ name', :text => 'Public query for all projects' end diff --git a/test/integration/api_test/roles_test.rb b/test/integration/api_test/roles_test.rb index dc2275c08..128882c67 100644 --- a/test/integration/api_test/roles_test.rb +++ b/test/integration/api_test/roles_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'roles role', 3 assert_select 'roles[type=array] role id', :text => '2' do @@ -38,7 +38,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json @@ -51,7 +51,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'role' do assert_select 'name', :text => 'Manager' diff --git a/test/integration/api_test/search_test.rb b/test/integration/api_test/search_test.rb index 891090140..fe592a2b9 100644 --- a/test/integration/api_test/search_test.rb +++ b/test/integration/api_test/search_test.rb @@ -32,14 +32,14 @@ class Redmine::ApiTest::SearchTest < Redmine::ApiTest::Base get '/search.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type end test "GET /search.json should return json content" do get '/search.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json diff --git a/test/integration/api_test/time_entries_test.rb b/test/integration/api_test/time_entries_test.rb index f42d0ae97..ce6d39b96 100644 --- a/test/integration/api_test/time_entries_test.rb +++ b/test/integration/api_test/time_entries_test.rb @@ -32,21 +32,21 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base test "GET /time_entries.xml should return time entries" do get '/time_entries.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entries[type=array] time_entry id', :text => '2' end test "GET /time_entries.xml with limit should return limited results" do get '/time_entries.xml?limit=2', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entries[type=array] time_entry', 2 end test "GET /time_entries/:id.xml should return the time entry" do get '/time_entries/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry id', :text => '2' end @@ -57,7 +57,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base get '/time_entries/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry id', :text => '2' end @@ -77,7 +77,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'jsmith', entry.user.login @@ -103,7 +103,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'accepted', entry.custom_field_value(field) @@ -120,7 +120,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'jsmith', entry.user.login @@ -139,7 +139,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Hours cannot be blank" end @@ -164,7 +164,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Hours cannot be blank" end @@ -193,7 +193,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base delete '/time_entries/2.xml', :headers => credentials('jsmith') end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors' end end diff --git a/test/integration/api_test/trackers_test.rb b/test/integration/api_test/trackers_test.rb index 26916c95e..92bdb750f 100644 --- a/test/integration/api_test/trackers_test.rb +++ b/test/integration/api_test/trackers_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base get '/trackers.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker id', :text => '2' do assert_select '~ name', :text => 'Feature request' diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 7ffd21f24..3d0722e7d 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'users' do assert_select 'user', User.active.count end @@ -36,7 +36,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users.json', :headers => credentials('admin') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') assert_equal User.active.count, json['users'].size @@ -157,7 +157,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert user.check_password?('secret123') assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'user id', :text => user.id.to_s end @@ -200,7 +200,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert !user.admin? assert_response :created - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Hash, json['user'] @@ -220,7 +220,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -237,7 +237,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') @@ -306,7 +306,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -324,7 +324,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb index a05704d87..e8b0c63cf 100644 --- a/test/integration/api_test/versions_test.rb +++ b/test/integration/api_test/versions_test.rb @@ -35,7 +35,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base get '/projects/1/versions.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'versions[type=array] version id', :text => '2' do assert_select '~ name', :text => '1.0' @@ -53,7 +53,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal 'API test', version.name assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -69,7 +69,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal Date.parse('2012-01-24'), version.due_date assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -85,7 +85,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal WikiPage.first, version.wiki_page assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -109,7 +109,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal 'Some value', version.custom_field_value(field) assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version>custom_fields>custom_field[id=?]>value', field.id.to_s, 'Some value' end @@ -132,7 +132,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base get '/versions/2.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version' do assert_select 'id', :text => '2' assert_select 'name', :text => '1.0' diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb index ae980129f..9245f9837 100644 --- a/test/integration/api_test/wiki_pages_test.rb +++ b/test/integration/api_test/wiki_pages_test.rb @@ -27,7 +27,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/index.xml should return wiki pages" do get '/projects/ecookbook/wiki/index.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_pages[type=array]' do assert_select 'wiki_page', :count => Wiki.find(1).pages.count assert_select 'wiki_page' do @@ -46,7 +46,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml should return wiki page" do get '/projects/ecookbook/wiki/CookBook_documentation.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'CookBook_documentation' assert_select 'version', :text => '3' @@ -61,7 +61,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml?include=attachments should include attachments" do get '/projects/ecookbook/wiki/Page_with_an_inline_image.xml?include=attachments' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'Page_with_an_inline_image' assert_select 'attachments[type=array]' do @@ -76,13 +76,13 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml with unknown title and edit permission should respond with 404" do get '/projects/ecookbook/wiki/Invalid_Page.xml', :headers => credentials('jsmith') assert_response 404 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end test "GET /projects/:project_id/wiki/:title/:version.xml should return wiki page version" do get '/projects/ecookbook/wiki/CookBook_documentation/2.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'CookBook_documentation' assert_select 'version', :text => '2' @@ -99,7 +99,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base get '/projects/ecookbook/wiki/CookBook_documentation/2.xml' assert_response 401 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end test "PUT /projects/:project_id/wiki/:title.xml should update wiki page" do diff --git a/test/integration/attachments_test.rb b/test/integration/attachments_test.rb index 5802d36c5..1ff423e5d 100644 --- a/test/integration/attachments_test.rb +++ b/test/integration/attachments_test.rb @@ -167,7 +167,7 @@ class AttachmentsTest < Redmine::IntegrationTest :params => content, :headers => {"CONTENT_TYPE" => 'application/octet-stream'}) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end token = response.body.match(/\.val\('(\d+\.[0-9a-f]+)'\)/)[1] diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb index cd4159d9a..5b9dcfbf0 100644 --- a/test/integration/welcome_test.rb +++ b/test/integration/welcome_test.rb @@ -26,7 +26,7 @@ class WelcomeTest < Redmine::IntegrationTest def test_robots get '/robots.txt' assert_response :success - assert_equal 'text/plain', @response.content_type + assert_equal 'text/plain', @response.media_type # Redmine::Utils.relative_url_root does not effect on Rails 5.1.4. assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) end |