diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-26 08:42:40 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-26 08:42:40 +0000 |
commit | 899f06612a4768538bf23faf5e4b0f4377c6d399 (patch) | |
tree | 335772f6dcc3dbadfc31b4d5907967734be3c32a /test | |
parent | 7ae53845ac48bd8b0a87bf8faff3e16742c37cfe (diff) | |
download | redmine-899f06612a4768538bf23faf5e4b0f4377c6d399.tar.gz redmine-899f06612a4768538bf23faf5e4b0f4377c6d399.zip |
Moves the LDAP test server to a fixture.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3490 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/auth_sources.yml | 15 | ||||
-rw-r--r-- | test/unit/auth_source_ldap_test.rb | 14 | ||||
-rw-r--r-- | test/unit/user_test.rb | 13 |
3 files changed, 18 insertions, 24 deletions
diff --git a/test/fixtures/auth_sources.yml b/test/fixtures/auth_sources.yml index 20670d5f5..e478ad0a7 100644 --- a/test/fixtures/auth_sources.yml +++ b/test/fixtures/auth_sources.yml @@ -1,2 +1,13 @@ ---- {} - +--- +auth_sources_001: + id: 1 + type: AuthSourceLdap + name: 'LDAP test server' + 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 diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb index d9f13ac82..bf868929e 100644 --- a/test/unit/auth_source_ldap_test.rb +++ b/test/unit/auth_source_ldap_test.rb @@ -18,7 +18,8 @@ require File.dirname(__FILE__) + '/../test_helper' class AuthSourceLdapTest < ActiveSupport::TestCase - + fixtures :auth_sources + def setup end @@ -37,16 +38,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase if ldap_configured? context '#authenticate' do setup do - @auth = AuthSourceLdap.generate!(:name => 'on the fly', - :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) - + @auth = AuthSourceLdap.find(1) end context 'with a valid LDAP user' do diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 8d5ce9742..f33c0af7d 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -18,7 +18,7 @@ require File.dirname(__FILE__) + '/../test_helper' class UserTest < ActiveSupport::TestCase - fixtures :users, :members, :projects, :roles, :member_roles + fixtures :users, :members, :projects, :roles, :member_roles, :auth_sources def setup @admin = User.find(1) @@ -124,16 +124,7 @@ class UserTest < ActiveSupport::TestCase 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) - + @auth_source = AuthSourceLdap.find(1) end context "with a successful authentication" do |