summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-02-11 19:07:23 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-02-11 19:07:23 +0000
commit876fb69271edf6b5d7fe15fc68ee49e246d38f19 (patch)
tree3b33cc6c9ea32ff9e023073882fb5b7a4dddda51 /test
parent48e26aa75b415045a6b83a37cafef478b996ca8a (diff)
downloadredmine-876fb69271edf6b5d7fe15fc68ee49e246d38f19.tar.gz
redmine-876fb69271edf6b5d7fe15fc68ee49e246d38f19.zip
Added tests for the other OpenID authentication cases. #699
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2445 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/account_controller_test.rb18
-rw-r--r--test/test_helper.rb2
2 files changed, 16 insertions, 4 deletions
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 8de6f64b5..e262b3716 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -70,12 +70,24 @@ class AccountControllerTest < Test::Unit::TestCase
end
def test_login_with_openid_with_new_user_created
-
+ post :login, :openid_url => 'http://openid.example.com/good_user'
+ assert_redirected_to 'my/page'
+ user = User.find_by_login('cool_user')
+ assert user
+ assert_equal 'Cool', user.firstname
+ assert_equal 'User', user.lastname
end
-
- def test_login_with_openid_with_new_user_with_conflict
+ def test_login_with_openid_with_new_user_with_conflict_should_register
+ existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com')
+ existing_user.login = 'cool_user'
+ assert existing_user.save!
+ post :login, :openid_url => 'http://openid.example.com/good_user'
+ assert_response :success
+ assert_template 'register'
+ assert assigns(:user)
+ assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url]
end
def test_autologin
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 57866d49e..ebc9bae46 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -19,7 +19,7 @@ ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require File.expand_path(File.dirname(__FILE__) + '/helper_testcase')
-load File.join(RAILS_ROOT,'test', 'mocks', 'open_id_authentication_mock.rb')
+require File.join(RAILS_ROOT,'test', 'mocks', 'open_id_authentication_mock.rb')
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method