summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 06:22:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-07 06:22:35 +0000
commit76a4b81cf3a9a6c8b4a8a1fa6dca65c841508454 (patch)
tree62edc7b1ab63a870af235d70fbd0ad236481ad26 /test/functional
parent6086aa1be4b2010383c702982847434e30960d1e (diff)
downloadredmine-76a4b81cf3a9a6c8b4a8a1fa6dca65c841508454.tar.gz
redmine-76a4b81cf3a9a6c8b4a8a1fa6dca65c841508454.zip
Fixed: Openid registration form should not require user to enter password (#11331).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9929 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/account_controller_openid_test.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/account_controller_openid_test.rb b/test/functional/account_controller_openid_test.rb
index ccee3d256..12e15c52e 100644
--- a/test/functional/account_controller_openid_test.rb
+++ b/test/functional/account_controller_openid_test.rb
@@ -116,6 +116,42 @@ class AccountControllerTest < ActionController::TestCase
assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url]
end
+ def test_login_with_openid_with_new_user_with_missing_information_should_register
+ Setting.self_registration = '3'
+
+ post :login, :openid_url => 'http://openid.example.com/good_blank_user'
+ assert_response :success
+ assert_template 'register'
+ assert assigns(:user)
+ assert_equal 'http://openid.example.com/good_blank_user', assigns(:user)[:identity_url]
+
+ assert_select 'input[name=?]', 'user[login]'
+ assert_select 'input[name=?]', 'user[password]'
+ assert_select 'input[name=?]', 'user[password_confirmation]'
+ assert_select 'input[name=?][value=?]', 'user[identity_url]', 'http://openid.example.com/good_blank_user'
+ end
+
+ def test_register_after_login_failure_should_not_require_user_to_enter_a_password
+ Setting.self_registration = '3'
+
+ assert_difference 'User.count' do
+ post :register, :user => {
+ :login => 'good_blank_user',
+ :password => '',
+ :password_confirmation => '',
+ :firstname => 'Cool',
+ :lastname => 'User',
+ :mail => 'user@somedomain.com',
+ :identity_url => 'http://openid.example.com/good_blank_user'
+ }
+ assert_response 302
+ end
+
+ user = User.first(:order => 'id DESC')
+ assert_equal 'http://openid.example.com/good_blank_user', user.identity_url
+ assert user.hashed_password.blank?, "Hashed password was #{user.hashed_password}"
+ end
+
def test_setting_openid_should_return_true_when_set_to_true
assert_equal true, Setting.openid?
end