diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-02-11 19:07:28 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-02-11 19:07:28 +0000 |
commit | 8194cfaf8690e09766120eb6517ca1b1c8cdc6e0 (patch) | |
tree | b33b2ffe1925621771433b420b7502f4ec514c43 /test/functional/account_controller_test.rb | |
parent | 876fb69271edf6b5d7fe15fc68ee49e246d38f19 (diff) | |
download | redmine-8194cfaf8690e09766120eb6517ca1b1c8cdc6e0.tar.gz redmine-8194cfaf8690e09766120eb6517ca1b1c8cdc6e0.zip |
Added user setup needed based on the system's registration settings
* Copied the register action's chunk of code used to setup the account
based on Setting.self_registration
* Extracted method for when onthefly_creation_failed
* Added tests to confirm the behavior
#699
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2446 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/account_controller_test.rb')
-rw-r--r-- | test/functional/account_controller_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index e262b3716..c665d3192 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -65,11 +65,13 @@ class AccountControllerTest < Test::Unit::TestCase end def test_login_with_openid + Setting.self_registration = '3' post :login, :openid_url => 'http://openid.example.com/good_user' assert_redirected_to 'my/page' end def test_login_with_openid_with_new_user_created + Setting.self_registration = '3' post :login, :openid_url => 'http://openid.example.com/good_user' assert_redirected_to 'my/page' user = User.find_by_login('cool_user') @@ -78,7 +80,28 @@ class AccountControllerTest < Test::Unit::TestCase assert_equal 'User', user.lastname end + def test_login_with_openid_with_new_user_created_with_email_activation_should_have_a_token + Setting.self_registration = '1' + post :login, :openid_url => 'http://openid.example.com/good_user' + assert_redirected_to 'login' + user = User.find_by_login('cool_user') + assert user + + token = Token.find_by_user_id_and_action(user.id, 'register') + assert token + end + + def test_login_with_openid_with_new_user_created_with_manual_activation + Setting.self_registration = '2' + post :login, :openid_url => 'http://openid.example.com/good_user' + assert_redirected_to 'login' + user = User.find_by_login('cool_user') + assert user + assert_equal User::STATUS_REGISTERED, user.status + end + def test_login_with_openid_with_new_user_with_conflict_should_register + Setting.self_registration = '3' existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com') existing_user.login = 'cool_user' assert existing_user.save! |