Use 8+ characters long passwords in tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10886 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -119,8 +119,8 @@ class AccountControllerTest < ActionController::TestCase
|
||||
assert_difference 'User.count' do
|
||||
post :register, :user => {
|
||||
:login => 'register',
|
||||
:password => 'test',
|
||||
:password_confirmation => 'test',
|
||||
:password => 'secret123',
|
||||
:password_confirmation => 'secret123',
|
||||
:firstname => 'John',
|
||||
:lastname => 'Doe',
|
||||
:mail => 'register@example.com'
|
||||
@@ -132,7 +132,7 @@ class AccountControllerTest < ActionController::TestCase
|
||||
assert_equal 'John', user.firstname
|
||||
assert_equal 'Doe', user.lastname
|
||||
assert_equal 'register@example.com', user.mail
|
||||
assert user.check_password?('test')
|
||||
assert user.check_password?('secret123')
|
||||
assert user.active?
|
||||
end
|
||||
end
|
||||
@@ -218,10 +218,10 @@ class AccountControllerTest < ActionController::TestCase
|
||||
user = User.find(2)
|
||||
token = Token.create!(:action => 'recovery', :user => user)
|
||||
|
||||
post :lost_password, :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'newpass'
|
||||
post :lost_password, :token => token.value, :new_password => 'newpass123', :new_password_confirmation => 'newpass123'
|
||||
assert_redirected_to '/login'
|
||||
user.reload
|
||||
assert user.check_password?('newpass')
|
||||
assert user.check_password?('newpass123')
|
||||
assert_nil Token.find_by_id(token.id), "Token was not deleted"
|
||||
end
|
||||
|
||||
@@ -230,9 +230,9 @@ class AccountControllerTest < ActionController::TestCase
|
||||
token = Token.create!(:action => 'recovery', :user => user)
|
||||
user.lock!
|
||||
|
||||
post :lost_password, :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'newpass'
|
||||
post :lost_password, :token => token.value, :new_password => 'newpass123', :new_password_confirmation => 'newpass123'
|
||||
assert_redirected_to '/'
|
||||
assert ! user.check_password?('newpass')
|
||||
assert ! user.check_password?('newpass123')
|
||||
end
|
||||
|
||||
def test_post_lost_password_with_token_and_password_confirmation_failure_should_redisplay_the_form
|
||||
|
||||
@@ -145,26 +145,26 @@ class MyControllerTest < ActionController::TestCase
|
||||
|
||||
# non matching password confirmation
|
||||
post :password, :password => 'jsmith',
|
||||
:new_password => 'hello',
|
||||
:new_password_confirmation => 'hello2'
|
||||
:new_password => 'secret123',
|
||||
:new_password_confirmation => 'secret1234'
|
||||
assert_response :success
|
||||
assert_template 'password'
|
||||
assert_error_tag :content => /Password doesn't match confirmation/
|
||||
|
||||
# wrong password
|
||||
post :password, :password => 'wrongpassword',
|
||||
:new_password => 'hello',
|
||||
:new_password_confirmation => 'hello'
|
||||
:new_password => 'secret123',
|
||||
:new_password_confirmation => 'secret123'
|
||||
assert_response :success
|
||||
assert_template 'password'
|
||||
assert_equal 'Wrong password', flash[:error]
|
||||
|
||||
# good password
|
||||
post :password, :password => 'jsmith',
|
||||
:new_password => 'hello',
|
||||
:new_password_confirmation => 'hello'
|
||||
:new_password => 'secret123',
|
||||
:new_password_confirmation => 'secret123'
|
||||
assert_redirected_to '/my/account'
|
||||
assert User.try_to_login('jsmith', 'hello')
|
||||
assert User.try_to_login('jsmith', 'secret123')
|
||||
end
|
||||
|
||||
def test_change_password_should_redirect_if_user_cannot_change_its_password
|
||||
|
||||
@@ -173,8 +173,8 @@ class UsersControllerTest < ActionController::TestCase
|
||||
:firstname => 'John',
|
||||
:lastname => 'Doe',
|
||||
:login => 'jdoe',
|
||||
:password => 'secret',
|
||||
:password_confirmation => 'secret',
|
||||
:password => 'secret123',
|
||||
:password_confirmation => 'secret123',
|
||||
:mail => 'jdoe@gmail.com',
|
||||
:mail_notification => 'none'
|
||||
},
|
||||
@@ -190,7 +190,7 @@ class UsersControllerTest < ActionController::TestCase
|
||||
assert_equal 'jdoe', user.login
|
||||
assert_equal 'jdoe@gmail.com', user.mail
|
||||
assert_equal 'none', user.mail_notification
|
||||
assert user.check_password?('secret')
|
||||
assert user.check_password?('secret123')
|
||||
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
assert_not_nil mail
|
||||
@@ -205,8 +205,8 @@ class UsersControllerTest < ActionController::TestCase
|
||||
:firstname => 'John',
|
||||
:lastname => 'Doe',
|
||||
:login => 'jdoe',
|
||||
:password => 'secret',
|
||||
:password_confirmation => 'secret',
|
||||
:password => 'secret123',
|
||||
:password_confirmation => 'secret123',
|
||||
:mail => 'jdoe@gmail.com',
|
||||
:mail_notification => 'none'
|
||||
},
|
||||
@@ -287,14 +287,14 @@ class UsersControllerTest < ActionController::TestCase
|
||||
ActionMailer::Base.deliveries.clear
|
||||
Setting.bcc_recipients = '1'
|
||||
|
||||
put :update, :id => 2, :user => {:password => 'newpass', :password_confirmation => 'newpass'}, :send_information => '1'
|
||||
put :update, :id => 2, :user => {:password => 'newpass123', :password_confirmation => 'newpass123'}, :send_information => '1'
|
||||
u = User.find(2)
|
||||
assert u.check_password?('newpass')
|
||||
assert u.check_password?('newpass123')
|
||||
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
assert_not_nil mail
|
||||
assert_equal [u.mail], mail.bcc
|
||||
assert_mail_body_match 'newpass', mail
|
||||
assert_mail_body_match 'newpass123', mail
|
||||
end
|
||||
|
||||
def test_update_user_switchin_from_auth_source_to_password_authentication
|
||||
@@ -303,10 +303,10 @@ class UsersControllerTest < ActionController::TestCase
|
||||
u.auth_source = AuthSource.find(1)
|
||||
u.save!
|
||||
|
||||
put :update, :id => u.id, :user => {:auth_source_id => '', :password => 'newpass', :password_confirmation => 'newpass'}
|
||||
put :update, :id => u.id, :user => {:auth_source_id => '', :password => 'newpass123', :password_confirmation => 'newpass123'}
|
||||
|
||||
assert_equal nil, u.reload.auth_source
|
||||
assert u.check_password?('newpass')
|
||||
assert u.check_password?('newpass123')
|
||||
end
|
||||
|
||||
def test_update_notified_project
|
||||
|
||||
Reference in New Issue
Block a user