summaryrefslogtreecommitdiffstats
path: root/test/integration/account_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-08-05 17:58:33 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-08-05 17:58:33 +0000
commitb764e398475c26217bcca8ac9063f053bc1cf627 (patch)
treef8c44b9b990ff60f3cf51fe65bb8dad9dae8bd35 /test/integration/account_test.rb
parentbd4fba08e5bec539a746e9be422b9c2baab51406 (diff)
downloadredmine-b764e398475c26217bcca8ac9063f053bc1cf627.tar.gz
redmine-b764e398475c26217bcca8ac9063f053bc1cf627.zip
Option to force a user to change his password (#3872).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12081 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/account_test.rb')
-rw-r--r--test/integration/account_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb
index 1f9741b33..2f96005f5 100644
--- a/test/integration/account_test.rb
+++ b/test/integration/account_test.rb
@@ -128,6 +128,35 @@ class AccountTest < ActionController::IntegrationTest
assert_equal 0, Token.count
end
+ def test_user_with_must_change_passwd_should_be_forced_to_change_its_password
+ User.find_by_login('jsmith').update_attribute :must_change_passwd, true
+
+ post '/login', :username => 'jsmith', :password => 'jsmith'
+ assert_redirected_to '/my/page'
+ follow_redirect!
+ assert_redirected_to '/my/password'
+
+ get '/issues'
+ assert_redirected_to '/my/password'
+ end
+
+ def test_user_with_must_change_passwd_should_be_able_to_change_its_password
+ User.find_by_login('jsmith').update_attribute :must_change_passwd, true
+
+ post '/login', :username => 'jsmith', :password => 'jsmith'
+ assert_redirected_to '/my/page'
+ follow_redirect!
+ assert_redirected_to '/my/password'
+ follow_redirect!
+ assert_response :success
+ post '/my/password', :password => 'jsmith', :new_password => 'newpassword', :new_password_confirmation => 'newpassword'
+ assert_redirected_to '/my/account'
+ follow_redirect!
+ assert_response :success
+
+ assert_equal false, User.find_by_login('jsmith').must_change_passwd?
+ end
+
def test_register_with_automatic_activation
Setting.self_registration = '3'