diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-19 19:42:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-06-19 19:42:49 +0000 |
commit | e12322dac3baf3c31ea1487884f3b9c3273466ba (patch) | |
tree | dea21182473f3ce451b352fde3df33ea9a1ff15a /test/integration | |
parent | 854177554905159506220cd88aa765fca47bf756 (diff) | |
download | redmine-e12322dac3baf3c31ea1487884f3b9c3273466ba.tar.gz redmine-e12322dac3baf3c31ea1487884f3b9c3273466ba.zip |
Adds a configuration setting to enable sudo mode, disabled by default (#19851).
git-svn-id: http://svn.redmine.org/redmine/trunk@14336 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/admin_test.rb | 17 | ||||
-rw-r--r-- | test/integration/sudo_test.rb | 26 |
2 files changed, 23 insertions, 20 deletions
diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb index ef95cc9df..402d0ed3a 100644 --- a/test/integration/admin_test.rb +++ b/test/integration/admin_test.rb @@ -26,14 +26,6 @@ class AdminTest < Redmine::IntegrationTest :members, :enabled_modules - def setup - Redmine::SudoMode.enable! - end - - def teardown - Redmine::SudoMode.disable! - end - def test_add_user log_user("admin", "admin") get "/users/new" @@ -44,15 +36,6 @@ class AdminTest < Redmine::IntegrationTest :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en", :password => "psmith09", :password_confirmation => "psmith09" } - assert_response :success - assert_nil User.find_by_login("psmith") - - post "/users", - :user => { :login => "psmith", :firstname => "Paul", - :lastname => "Smith", :mail => "psmith@somenet.foo", - :language => "en", :password => "psmith09", - :password_confirmation => "psmith09" }, - :sudo_password => 'admin' user = User.find_by_login("psmith") assert_kind_of User, user diff --git a/test/integration/sudo_test.rb b/test/integration/sudo_test.rb index 13ccd0b96..3bccd84a2 100644 --- a/test/integration/sudo_test.rb +++ b/test/integration/sudo_test.rb @@ -4,11 +4,31 @@ class SudoTest < Redmine::IntegrationTest fixtures :projects, :members, :member_roles, :roles, :users def setup - Redmine::SudoMode.enable! + Redmine::SudoMode.stubs(:enabled?).returns(true) end - def teardown - Redmine::SudoMode.disable! + def test_add_user + log_user("admin", "admin") + get "/users/new" + assert_response :success + post "/users", + :user => { :login => "psmith", :firstname => "Paul", + :lastname => "Smith", :mail => "psmith@somenet.foo", + :language => "en", :password => "psmith09", + :password_confirmation => "psmith09" } + assert_response :success + assert_nil User.find_by_login("psmith") + + post "/users", + :user => { :login => "psmith", :firstname => "Paul", + :lastname => "Smith", :mail => "psmith@somenet.foo", + :language => "en", :password => "psmith09", + :password_confirmation => "psmith09" }, + :sudo_password => 'admin' + assert_response 302 + + user = User.find_by_login("psmith") + assert_kind_of User, user end def test_create_member_xhr |