OSDN Git Service

Moves the LDAP test server to a fixture.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 26 Feb 2010 08:42:40 +0000 (08:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 26 Feb 2010 08:42:40 +0000 (08:42 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3490 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/fixtures/auth_sources.yml
test/unit/auth_source_ldap_test.rb
test/unit/user_test.rb

index 20670d5..e478ad0 100644 (file)
@@ -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
index d9f13ac..bf86892 100644 (file)
@@ -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
index 8d5ce97..f33c0af 100644 (file)
@@ -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