summaryrefslogtreecommitdiffstats
path: root/test/integration/account_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/account_test.rb')
-rw-r--r--test/integration/account_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb
index 7f2f0e4ff..9ff6cc0a3 100644
--- a/test/integration/account_test.rb
+++ b/test/integration/account_test.rb
@@ -150,6 +150,40 @@ class AccountTest < Redmine::IntegrationTest
assert_equal false, User.find_by_login('jsmith').must_change_passwd?
end
+ def test_user_with_expired_password_should_be_forced_to_change_its_password
+ User.find_by_login('jsmith').update_attribute :passwd_changed_on, 14.days.ago
+
+ with_settings :password_max_age => 7 do
+ 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
+ end
+
+ def test_user_with_expired_password_should_be_able_to_change_its_password
+ User.find_by_login('jsmith').update_attribute :passwd_changed_on, 14.days.ago
+
+ with_settings :password_max_age => 7 do
+ 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
+
+ end
+
def test_register_with_automatic_activation
Setting.self_registration = '3'