diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-02-25 16:19:55 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-02-25 16:19:55 +0000 |
commit | 19d4ddf2f2158c5210a0b10cdd9934cbf93885c2 (patch) | |
tree | b879a4ad473ec86a477df7d58216be66097b2a58 /test | |
parent | 39c97279ca6fe8864d44f6892f8769f656cba487 (diff) | |
download | redmine-19d4ddf2f2158c5210a0b10cdd9934cbf93885c2.tar.gz redmine-19d4ddf2f2158c5210a0b10cdd9934cbf93885c2.zip |
Fix LDAP on the fly creation. The User object doesn't have a :dn attribute.
Fixes #4918 and adds a test for the behavior.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3485 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/user_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index a94870dbc..8d5ce9742 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -120,6 +120,36 @@ class UserTest < ActiveSupport::TestCase assert_equal nil, user end + if ldap_configured? + context "#try_to_login using LDAP" do + context "on the fly registration" do + setup do + @auth_source = AuthSourceLdap.generate!(:name => 'localhost', + :host => '127.0.0.1', + :port => 389, + :base_dn => 'OU=Person,DC=redmine,DC=org', + :attr_login => 'uid', + :attr_firstname => 'givenName', + :attr_lastname => 'sn', + :attr_mail => 'mail', + :onthefly_register => true) + + end + + context "with a successful authentication" do + should "create a new user account" do + assert_difference('User.count') do + User.try_to_login('edavis', '123456') + end + end + end + end + end + + else + puts "Skipping LDAP tests." + end + def test_create_anonymous AnonymousUser.delete_all anon = User.anonymous |