diff options
author | Go MAEDA <maeda@farend.jp> | 2020-03-10 03:26:23 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-03-10 03:26:23 +0000 |
commit | 463e8163fc7edfea8319d7635866cc1f8d68b6ad (patch) | |
tree | 0711dc718dfba7b4a7a46ea97cd71173ca6e9bf1 /test/integration/sudo_mode_test.rb | |
parent | 852290edb01a5193d0d638007bfd48ef5b8a5c14 (diff) | |
download | redmine-463e8163fc7edfea8319d7635866cc1f8d68b6ad.tar.gz redmine-463e8163fc7edfea8319d7635866cc1f8d68b6ad.zip |
Require sudo mode for actions to delete contents (#33071).
Patch by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@19569 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/sudo_mode_test.rb')
-rw-r--r-- | test/integration/sudo_mode_test.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/integration/sudo_mode_test.rb b/test/integration/sudo_mode_test.rb index a2ff7cd09..389bc9daf 100644 --- a/test/integration/sudo_mode_test.rb +++ b/test/integration/sudo_mode_test.rb @@ -3,7 +3,9 @@ require File.expand_path('../../test_helper', __FILE__) class SudoModeTest < Redmine::IntegrationTest - fixtures :projects, :members, :member_roles, :roles, :users, :email_addresses + fixtures :projects, :members, :member_roles, :roles, :users, + :email_addresses, :trackers, :projects_trackers, :enabled_modules, + :issue_statuses, :issues, :enumerations def setup Redmine::SudoMode.stubs(:enabled?).returns(true) @@ -192,6 +194,24 @@ class SudoModeTest < Redmine::IntegrationTest end end + def test_destroy_issue + log_user 'dlopper', 'foo' + expire_sudo_mode! + delete '/issues/2' + assert_response :success + assert_select 'h2', 'Confirm your password to continue' + assert_select 'form[action="/issues/2"]' + assert_select '#flash_error', 0 + + delete '/issues/2', :params => {:sudo_password => 'wrong'} + assert_response :success + assert_select 'h2', 'Confirm your password to continue' + + assert_difference 'Issue.count', -1 do + delete '/issues/2', :params => {:sudo_password => 'foo'} + end + end + private # sudo mode is active after sign, let it expire by advancing the time |