diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api_test/attachments_test.rb | 2 | ||||
-rw-r--r-- | test/integration/api_test/authentication_test.rb | 8 | ||||
-rw-r--r-- | test/integration/api_test/custom_fields_test.rb | 2 | ||||
-rw-r--r-- | test/integration/api_test/news_test.rb | 2 | ||||
-rw-r--r-- | test/integration/attachments_test.rb | 10 | ||||
-rw-r--r-- | test/integration/issues_test.rb | 2 | ||||
-rw-r--r-- | test/integration/repositories_git_test.rb | 1 | ||||
-rw-r--r-- | test/integration/routing/attachments_test.rb | 2 | ||||
-rw-r--r-- | test/integration/sudo_mode_test.rb | 10 |
9 files changed, 32 insertions, 7 deletions
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index 9bb079c3d..524399bdc 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -63,7 +63,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/download/:id/:filename should deny access without credentials" do get '/attachments/download/7/archive.zip' - assert_response :unauthorized + assert_response :redirect end test "GET /attachments/thumbnail/:id should return the thumbnail" do diff --git a/test/integration/api_test/authentication_test.rb b/test/integration/api_test/authentication_test.rb index 23641b53a..4145fb969 100644 --- a/test/integration/api_test/authentication_test.rb +++ b/test/integration/api_test/authentication_test.rb @@ -127,20 +127,23 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base assert_response :unauthorized end + # TODO: check why this test does not use the API endpoint def test_api_should_accept_switch_user_header_for_admin_user user = User.find(1) su = User.find(4) get '/users/current', :headers => {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login} assert_response :success - assert_select 'h2', :text => su.name + assert_select 'h2', :text => "#{su.initials} #{su.name}" end + # TODO: check why this test does not use the API endpoint def test_api_should_respond_with_412_when_trying_to_switch_to_a_invalid_user get '/users/current', :headers => {'X-Redmine-API-Key' => User.find(1).api_key, 'X-Redmine-Switch-User' => 'foobar'} assert_response :precondition_failed end + # TODO: check why this test does not use the API endpoint def test_api_should_respond_with_412_when_trying_to_switch_to_a_locked_user user = User.find(5) assert user.locked? @@ -149,12 +152,13 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base assert_response :precondition_failed end + # TODO: check why this test does not use the API endpoint def test_api_should_not_accept_switch_user_header_for_non_admin_user user = User.find(2) su = User.find(4) get '/users/current', :headers => {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login} assert_response :success - assert_select 'h2', :text => user.name + assert_select 'h2', :text => "#{user.initials} #{user.name}" end end diff --git a/test/integration/api_test/custom_fields_test.rb b/test/integration/api_test/custom_fields_test.rb index 0df56e59a..4fb06636e 100644 --- a/test/integration/api_test/custom_fields_test.rb +++ b/test/integration/api_test/custom_fields_test.rb @@ -37,6 +37,8 @@ class Redmine::ApiTest::CustomFieldsTest < Redmine::ApiTest::Base end assert_select 'trackers[type=array]' assert_select 'roles[type=array]' + assert_select 'visible', :text => 'true' + assert_select 'editable', :text => 'true' end end end diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index bd9f2bb6d..399b2b347 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.rb @@ -62,7 +62,7 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base assert_select "author[id=2][name=\"John Smith\"]" assert_select 'title', 'eCookbook first release !' assert_select 'summary', 'First version was released...' - assert_select 'description', "eCookbook 1.0 has been released.\n\nVisit http://ecookbook.somenet.foo/" + assert_select 'description', 'eCookbook 1.0 has been released. Visit http://ecookbook.somenet.foo/' assert_select 'created_on', News.find(1).created_on.iso8601 end end diff --git a/test/integration/attachments_test.rb b/test/integration/attachments_test.rb index f6a30d061..80d2040a1 100644 --- a/test/integration/attachments_test.rb +++ b/test/integration/attachments_test.rb @@ -267,6 +267,16 @@ class AttachmentsTest < Redmine::IntegrationTest end end + def test_unauthorized_named_download_link_should_redirect_to_login + with_settings login_required: '1' do + get "/attachments/download/1" + assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fattachments%2Fdownload%2F1" + + get "/attachments/download/1/error281.txt" + assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fattachments%2Fdownload%2F1%2Ferror281.txt" + end + end + private def ajax_upload(filename, content, attachment_id=1) diff --git a/test/integration/issues_test.rb b/test/integration/issues_test.rb index ac8d432f1..d0763091e 100644 --- a/test/integration/issues_test.rb +++ b/test/integration/issues_test.rb @@ -355,7 +355,7 @@ class IssuesTest < Redmine::IntegrationTest end # Issue view follow_redirect! - assert_select 'ul.details li', :text => "Tester changed from #{tester} to #{new_tester}" + assert_select 'ul.journal-details li', :text => "Tester changed from #{tester} to #{new_tester}" end end diff --git a/test/integration/repositories_git_test.rb b/test/integration/repositories_git_test.rb index 20d643449..793b49458 100644 --- a/test/integration/repositories_git_test.rb +++ b/test/integration/repositories_git_test.rb @@ -35,6 +35,7 @@ class RepositoriesGitTest < Redmine::IntegrationTest :path_encoding => 'ISO-8859-1' ) assert @repository + skip "SCM command is unavailable" unless @repository.class.scm_available end if File.directory?(REPOSITORY_PATH) diff --git a/test/integration/routing/attachments_test.rb b/test/integration/routing/attachments_test.rb index 15e61635b..18b411f99 100644 --- a/test/integration/routing/attachments_test.rb +++ b/test/integration/routing/attachments_test.rb @@ -26,7 +26,7 @@ class RoutingAttachmentsTest < Redmine::RoutingTest should_route 'GET /attachments/1/filename.txt' => 'attachments#show', :id => '1', :filename => 'filename.txt', :format => 'html' should_route 'GET /attachments/download/1' => 'attachments#download', :id => '1' - should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext' + should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext', :format => 'html' should_route 'GET /attachments/thumbnail/1' => 'attachments#thumbnail', :id => '1' should_route 'GET /attachments/thumbnail/1/200' => 'attachments#thumbnail', :id => '1', :size => '200' diff --git a/test/integration/sudo_mode_test.rb b/test/integration/sudo_mode_test.rb index 228e527ed..0c7de64e0 100644 --- a/test/integration/sudo_mode_test.rb +++ b/test/integration/sudo_mode_test.rb @@ -190,7 +190,7 @@ class SudoModeTest < Redmine::IntegrationTest expire_sudo_mode! get '/my/account' assert_response :success - put('/my/account', :params => {:user => {:mail => 'newmail@test.com'}}) + post('/my/account', :params => {:_method => 'put', :user => {:mail => 'newmail@test.com'}}) assert_response :success assert_select 'h2', 'Confirm your password to continue' assert_select 'form[action="/my/account"]' @@ -259,6 +259,14 @@ class SudoModeTest < Redmine::IntegrationTest end end + def test_sudo_mode_should_include_cache_control_no_store + log_user("admin", "admin") + expire_sudo_mode! + get '/settings' + assert_response :success + assert_includes @response.headers['Cache-Control'], 'no-store' + end + private # sudo mode is active after sign, let it expire by advancing the time |