diff options
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 |