mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
Use #media_type instead of #content_type to test the MIME type of a response (#32886).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19467 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -45,7 +45,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
|
||||
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||||
end
|
||||
@@ -64,7 +64,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'th.filename', :text => /issues_controller.rb\t\(r\?vision 1484\)/
|
||||
assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/
|
||||
end
|
||||
@@ -84,7 +84,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
)
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/
|
||||
assert_select 'td.line-code', :text => /Demande créée avec succès/
|
||||
end
|
||||
@@ -136,14 +136,14 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'th.filename', :text => 'test1.txt'
|
||||
end
|
||||
|
||||
def test_show_text_file
|
||||
get(:show, :params => {:id => 4})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
end
|
||||
|
||||
def test_show_text_file_utf_8
|
||||
@@ -155,7 +155,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'japanese-utf-8.txt', a.filename
|
||||
get(:show, :params => {:id => a.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'tr#L1' do
|
||||
assert_select 'th.line-num', :text => '1'
|
||||
assert_select 'td', :text => /日本語/
|
||||
@@ -172,7 +172,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'iso8859-1.txt', a.filename
|
||||
get(:show, :params => {:id => a.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'tr#L7' do
|
||||
assert_select 'th.line-num', :text => '7'
|
||||
assert_select 'td', :text => /Demande cr\?\?e avec succ\?s/
|
||||
@@ -190,7 +190,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'iso8859-1.txt', a.filename
|
||||
get(:show, :params => {:id => a.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'tr#L7' do
|
||||
assert_select 'th.line-num', :text => '7'
|
||||
assert_select 'td', :text => /Demande créée avec succès/
|
||||
@@ -204,7 +204,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
Attachment.find(4).update_attribute :filesize, 754.kilobyte
|
||||
get(:show, :params => {:id => 4})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||||
end
|
||||
end
|
||||
@@ -218,7 +218,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'testfile.md', a.filename
|
||||
get(:show, :params => {:id => a.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>"
|
||||
end
|
||||
|
||||
@@ -231,7 +231,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'testfile.textile', a.filename
|
||||
get(:show, :params => {:id => a.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n\n\t<h2>Header 2</h2>\n\n\n\t<h3>Header 3</h3>"
|
||||
end
|
||||
|
||||
@@ -239,14 +239,14 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get(:show, :params => {:id => 16})
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'img.filecontent', :src => attachments(:attachments_010).filename
|
||||
end
|
||||
|
||||
def test_show_other_with_no_preview
|
||||
@request.session[:user_id] = 2
|
||||
get(:show, :params => {:id => 6})
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select '.nodata', :text => 'No preview available. Download the file instead.'
|
||||
end
|
||||
|
||||
@@ -301,7 +301,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
def test_download_text_file
|
||||
get(:download, :params => {:id => 4})
|
||||
assert_response :success
|
||||
assert_equal 'application/x-ruby', @response.content_type
|
||||
assert_equal 'application/x-ruby', @response.media_type
|
||||
etag = @response.etag
|
||||
assert_not_nil etag
|
||||
|
||||
@@ -320,7 +320,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
|
||||
get(:download, :params => {:id => attachment.id})
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', @response.content_type
|
||||
assert_equal 'text/javascript', @response.media_type
|
||||
end
|
||||
|
||||
def test_download_version_file_with_issue_tracking_disabled
|
||||
@@ -333,21 +333,21 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
Attachment.find(4).update_attribute(:content_type, '')
|
||||
get(:download, :params => {:id => 4})
|
||||
assert_response :success
|
||||
assert_equal 'text/x-ruby', @response.content_type
|
||||
assert_equal 'text/x-ruby', @response.media_type
|
||||
end
|
||||
|
||||
def test_download_should_assign_better_content_type_than_application_octet_stream
|
||||
Attachment.find(4).update! :content_type => "application/octet-stream"
|
||||
get(:download, :params => {:id => 4})
|
||||
assert_response :success
|
||||
assert_equal 'text/x-ruby', @response.content_type
|
||||
assert_equal 'text/x-ruby', @response.media_type
|
||||
end
|
||||
|
||||
def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined
|
||||
get(:download, :params => {:id => 22})
|
||||
assert_response :success
|
||||
assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename)
|
||||
assert_equal 'application/octet-stream', @response.content_type
|
||||
assert_equal 'application/octet-stream', @response.media_type
|
||||
end
|
||||
|
||||
def test_download_missing_file
|
||||
@@ -371,7 +371,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'image/png', response.content_type
|
||||
assert_equal 'image/png', response.media_type
|
||||
|
||||
etag = @response.etag
|
||||
assert_not_nil etag
|
||||
@@ -459,7 +459,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'image/png', response.content_type
|
||||
assert_equal 'image/png', response.media_type
|
||||
end
|
||||
else
|
||||
puts '(GhostScript convert not available)'
|
||||
|
||||
@@ -197,7 +197,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
|
||||
:term => '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_kind_of Array, json
|
||||
assert_equal 2, json.size
|
||||
|
||||
@@ -263,7 +263,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
|
||||
assert_include '<option selected=\"selected\" value=\"list\">List<\/option>', response.body
|
||||
end
|
||||
|
||||
@@ -142,7 +142,7 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
:format => 'pdf'
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -151,7 +151,7 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
:format => 'pdf'
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -162,7 +162,7 @@ class GanttsControllerTest < Redmine::ControllerTest
|
||||
:format => 'png'
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'image/png', @response.content_type
|
||||
assert_equal 'image/png', @response.media_type
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_add_users
|
||||
@@ -217,7 +217,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_match /John Smith/, response.body
|
||||
end
|
||||
@@ -245,7 +245,7 @@ class GroupsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create
|
||||
@@ -100,7 +100,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
assert_equal 'New category', category.name
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create_from_issue_form_with_failure
|
||||
@@ -119,7 +119,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'Name cannot be blank', response.body
|
||||
end
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
relation = IssueRelation.order('id DESC').first
|
||||
assert_equal 1, relation.issue_from_id
|
||||
@@ -182,7 +182,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_include 'Related issue cannot be blank', response.body
|
||||
end
|
||||
@@ -217,7 +217,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'relation-2', response.body
|
||||
end
|
||||
end
|
||||
|
||||
@@ -463,7 +463,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', response.content_type
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_query_grouped_by_list_custom_field
|
||||
@@ -1081,7 +1081,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
|
||||
get(:index, :params => {:format => 'pdf'})
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
|
||||
get(
|
||||
:index,
|
||||
@@ -1091,7 +1091,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
|
||||
get(
|
||||
:index,
|
||||
@@ -1102,7 +1102,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1117,7 +1117,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
end
|
||||
|
||||
def test_index_atom
|
||||
@@ -1129,7 +1129,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/atom+xml', response.content_type
|
||||
assert_equal 'application/atom+xml', response.media_type
|
||||
|
||||
assert_select 'feed' do
|
||||
assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom'
|
||||
@@ -1612,7 +1612,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', response.content_type
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_description_column
|
||||
@@ -1635,7 +1635,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', response.content_type
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_last_notes_column
|
||||
@@ -1663,7 +1663,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', response.content_type
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_last_notes_column_should_display_private_notes_with_permission_only
|
||||
@@ -1887,7 +1887,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
}
|
||||
)
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select_error /Start date cannot be blank/i
|
||||
end
|
||||
|
||||
@@ -1902,7 +1902,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
:format => 'csv'
|
||||
}
|
||||
)
|
||||
assert_equal 'text/csv', @response.content_type
|
||||
assert_equal 'text/csv', @response.media_type
|
||||
assert @response.body.blank?
|
||||
end
|
||||
|
||||
@@ -2649,7 +2649,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/atom+xml', response.content_type
|
||||
assert_equal 'application/atom+xml', response.media_type
|
||||
# Inline image
|
||||
assert_select(
|
||||
'content',
|
||||
@@ -2668,7 +2668,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -2684,7 +2684,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
end
|
||||
@@ -2702,7 +2702,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -2721,7 +2721,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -2734,7 +2734,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -2754,7 +2754,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
|
||||
@@ -2773,7 +2773,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
end
|
||||
@@ -3526,7 +3526,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'This is the test_new issue', response.body
|
||||
end
|
||||
|
||||
@@ -5343,7 +5343,7 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
|
||||
assert_include 'This is the test_new issue', response.body
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
:project_id => 1
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
assert_equal 'application/atom+xml', @response.media_type
|
||||
end
|
||||
|
||||
def test_index_with_invalid_query_id
|
||||
@@ -166,7 +166,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include '> This is an issue', response.body
|
||||
end
|
||||
|
||||
@@ -188,7 +188,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'Redmine Admin wrote in #note-1:', response.body
|
||||
assert_include '> A comment with a private version', response.body
|
||||
end
|
||||
@@ -203,7 +203,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include '> Privates notes', response.body
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
@@ -222,7 +222,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'textarea', response.body
|
||||
end
|
||||
|
||||
@@ -236,7 +236,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'textarea', response.body
|
||||
|
||||
Role.find(1).remove_permission! :view_private_notes
|
||||
@@ -257,7 +257,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal 'Updated notes', Journal.find(2).notes
|
||||
assert_include 'journal-2-notes', response.body
|
||||
# response should include journal_indice param for quote link
|
||||
@@ -274,7 +274,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal true, Journal.find(2).private_notes
|
||||
assert_include 'change-2', response.body
|
||||
assert_include 'journal-2-private_notes', response.body
|
||||
@@ -291,7 +291,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_equal false, Journal.find(2).private_notes
|
||||
assert_include 'change-2', response.body
|
||||
assert_include 'journal-2-private_notes', response.body
|
||||
@@ -325,7 +325,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_nil Journal.find_by_id(2)
|
||||
assert_include 'change-2', response.body
|
||||
|
||||
@@ -56,7 +56,7 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create
|
||||
@@ -133,7 +133,7 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert User.find(7).member_of?(Project.find(1))
|
||||
assert User.find(8).member_of?(Project.find(1))
|
||||
@@ -152,7 +152,7 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_match /alert/, response.body, "Alert message not sent"
|
||||
end
|
||||
@@ -242,7 +242,7 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
member = Member.find(2)
|
||||
assert_equal [1], member.role_ids
|
||||
@@ -303,7 +303,7 @@ class MembersControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_nil Member.find_by_id(2)
|
||||
assert_include 'tab-content-members', response.body
|
||||
|
||||
@@ -266,7 +266,7 @@ class MessagesControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
|
||||
assert_include 'RE: First post', response.body
|
||||
assert_include "Redmine Admin wrote:", response.body
|
||||
@@ -281,7 +281,7 @@ class MessagesControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
|
||||
assert_include 'RE: First post', response.body
|
||||
assert_include 'John Smith wrote in message#3:', response.body
|
||||
|
||||
@@ -54,7 +54,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create_user_membership
|
||||
@@ -121,7 +121,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
member = Member.order('id DESC').first
|
||||
assert_equal User.find(7), member.principal
|
||||
@@ -141,7 +141,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_include 'alert', response.body, "Alert message not sent"
|
||||
assert_include 'Role cannot be empty', response.body, "Error message not sent"
|
||||
@@ -191,7 +191,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_equal [2], Member.find(1).role_ids
|
||||
assert_include '$("#member-1-roles").html("Developer").show();', response.body
|
||||
@@ -216,7 +216,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_nil Member.find_by_id(1)
|
||||
assert_include 'tab-content-memberships', response.body
|
||||
@@ -228,7 +228,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create_group_membership
|
||||
@@ -254,7 +254,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_match /OnlineStore/, response.body
|
||||
end
|
||||
@@ -270,7 +270,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_match /alert/, response.body, "Alert message not sent"
|
||||
end
|
||||
@@ -298,7 +298,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
end
|
||||
|
||||
@@ -319,7 +319,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest
|
||||
},
|
||||
:xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -240,7 +240,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_autocomplete_js_with_blank_search_term
|
||||
@@ -253,7 +253,7 @@ class ProjectsControllerTest < Redmine::ControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
test "#index by non-admin user with view_time_entries permission should show overall spent time link" do
|
||||
|
||||
@@ -706,7 +706,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
assert_equal 'application/json', response.media_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_include ["eCookbook - 2.0", "3", "open"], json
|
||||
end
|
||||
@@ -720,7 +720,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
assert_equal 'application/json', response.media_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_include ["eCookbook - 2.0", "3", "open"], json
|
||||
end
|
||||
@@ -735,7 +735,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
assert_equal 'application/json', response.media_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
|
||||
# response includes visible version
|
||||
@@ -756,7 +756,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
}
|
||||
|
||||
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 4, json.count
|
||||
assert_include ["Private child of eCookbook","5"], json
|
||||
@@ -770,7 +770,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
:name => 'assigned_to_id'
|
||||
}
|
||||
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 6, json.count
|
||||
@@ -788,7 +788,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
:name => 'author_id'
|
||||
}
|
||||
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 7, json.count
|
||||
@@ -807,7 +807,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
:name => 'user_id'
|
||||
}
|
||||
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 7, json.count
|
||||
@@ -827,7 +827,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
:name => 'watcher_id'
|
||||
}
|
||||
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.count
|
||||
@@ -844,7 +844,7 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
:name => 'watcher_id'
|
||||
}
|
||||
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 6, json.count
|
||||
|
||||
@@ -331,7 +331,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_equal [2], Changeset.find(103).issue_ids
|
||||
assert_include 'related-issues', response.body
|
||||
@@ -371,7 +371,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_include 'alert("Issue is invalid")', response.body
|
||||
end
|
||||
@@ -393,7 +393,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
||||
:xhr => true
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
assert_equal [1], Changeset.find(103).issue_ids
|
||||
assert_include 'related-issue-2', response.body
|
||||
@@ -413,7 +413,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
assert_equal 'application/json', response.media_type
|
||||
data = ActiveSupport::JSON.decode(response.body)
|
||||
assert_not_nil data['labels']
|
||||
assert_not_nil data['commits']
|
||||
@@ -430,7 +430,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
assert_equal 'application/json', response.media_type
|
||||
data = ActiveSupport::JSON.decode(response.body)
|
||||
assert_not_nil data['labels']
|
||||
assert_not_nil data['commits']
|
||||
|
||||
@@ -95,7 +95,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest
|
||||
:path => repository_path_hash(['test'])[:param]
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'application/octet-stream', @response.content_type
|
||||
assert_equal 'application/octet-stream', @response.media_type
|
||||
end
|
||||
|
||||
def test_show_non_ascii_contents
|
||||
@@ -138,7 +138,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest
|
||||
:path => repository_path_hash(['japanese', 'big-file.txt'])[:param]
|
||||
}
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'p.nodata'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -249,7 +249,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_select 'p.nodata'
|
||||
end
|
||||
end
|
||||
@@ -470,7 +470,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
|
||||
}
|
||||
)
|
||||
assert_response :success
|
||||
assert_equal 'text/x-patch', @response.content_type
|
||||
assert_equal 'text/x-patch', @response.media_type
|
||||
assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first
|
||||
end
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class SysControllerTest < Redmine::ControllerTest
|
||||
def test_projects_with_repository_enabled
|
||||
get :projects
|
||||
assert_response :success
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal 'application/json', @response.media_type
|
||||
|
||||
data = ActiveSupport::JSON.decode(response.body)
|
||||
|
||||
@@ -56,7 +56,7 @@ class SysControllerTest < Redmine::ControllerTest
|
||||
:repository => { :url => 'file:///create/project/repository/subproject2'}
|
||||
}
|
||||
assert_response :created
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal 'application/json', @response.media_type
|
||||
|
||||
r = Project.find(4).repository
|
||||
assert r.is_a?(Repository::Subversion)
|
||||
|
||||
@@ -1341,7 +1341,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
||||
def test_index_atom_feed
|
||||
get :index, :params => {:project_id => 1, :format => 'atom'}
|
||||
assert_response :success
|
||||
assert_equal 'application/atom+xml', @response.content_type
|
||||
assert_equal 'application/atom+xml', @response.media_type
|
||||
assert_select 'entry > title', :text => /7\.65 hours/
|
||||
end
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get :new, :params => {:project_id => '1'}, :xhr => true
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_create
|
||||
@@ -252,7 +252,7 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
assert_equal 1, version.project_id
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'test_add_version_from_issue_form', response.body
|
||||
end
|
||||
|
||||
@@ -262,7 +262,7 @@ class VersionsControllerTest < Redmine::ControllerTest
|
||||
post :create, :params => {:project_id => '1', :version => {:name => ''}}, :xhr => true
|
||||
end
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
end
|
||||
|
||||
def test_get_edit
|
||||
|
||||
@@ -1009,7 +1009,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :export, :params => {:project_id => 'ecookbook'}
|
||||
|
||||
assert_response :success
|
||||
assert_equal "text/html", @response.content_type
|
||||
assert_equal "text/html", @response.media_type
|
||||
|
||||
assert_select "a[name=?]", "CookBook_documentation"
|
||||
assert_select "a[name=?]", "Another_page"
|
||||
@@ -1021,7 +1021,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'}
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition']
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
end
|
||||
@@ -1086,7 +1086,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :show, :params => {:project_id => 1, :format => 'pdf'}
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert_equal 'application/pdf', @response.media_type
|
||||
assert_equal 'attachment; filename="CookBook_documentation.pdf"',
|
||||
@response.headers['Content-Disposition']
|
||||
end
|
||||
@@ -1096,7 +1096,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :show, :params => {:project_id => 1, :format => 'html'}
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_equal 'attachment; filename="CookBook_documentation.html"',
|
||||
@response.headers['Content-Disposition']
|
||||
assert_select 'h1', :text => /CookBook documentation/
|
||||
@@ -1107,7 +1107,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :show, :params => {:project_id => 1, :format => 'html', :version => 2}
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/html', @response.content_type
|
||||
assert_equal 'text/html', @response.media_type
|
||||
assert_equal 'attachment; filename="CookBook_documentation.html"',
|
||||
@response.headers['Content-Disposition']
|
||||
assert_select 'h1', :text => /CookBook documentation v2/
|
||||
@@ -1118,7 +1118,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :show, :params => {:project_id => 1, :format => 'txt'}
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/plain', @response.content_type
|
||||
assert_equal 'text/plain', @response.media_type
|
||||
assert_equal 'attachment; filename="CookBook_documentation.txt"',
|
||||
@response.headers['Content-Disposition']
|
||||
assert_include 'h1. CookBook documentation', @response.body
|
||||
@@ -1129,7 +1129,7 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
get :show, :params => {:project_id => 1, :format => 'txt', :version => 2}
|
||||
assert_response :success
|
||||
|
||||
assert_equal 'text/plain', @response.content_type
|
||||
assert_equal 'text/plain', @response.media_type
|
||||
assert_equal 'attachment; filename="CookBook_documentation.txt"',
|
||||
@response.headers['Content-Disposition']
|
||||
assert_include 'h1. CookBook documentation v2', @response.body
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -348,7 +348,7 @@ module Redmine
|
||||
|
||||
# Saves the generated PDF in tmp/test/pdf
|
||||
def save_pdf
|
||||
assert_equal 'application/pdf', response.content_type
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
filename = "#{self.class.name.underscore}__#{method_name}.pdf"
|
||||
File.open(File.join($redmine_tmp_pdf_directory, filename), "wb") do |f|
|
||||
f.write response.body
|
||||
@@ -431,8 +431,8 @@ module Redmine
|
||||
|
||||
# Parses the response body based on its content type
|
||||
def response_data
|
||||
unless response.content_type.to_s =~ /^application\/(.+)/
|
||||
raise "Unexpected response type: #{response.content_type}"
|
||||
unless response.media_type.to_s =~ /^application\/(.+)/
|
||||
raise "Unexpected response type: #{response.media_type}"
|
||||
end
|
||||
|
||||
format = $1
|
||||
|
||||
Reference in New Issue
Block a user