diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-26 08:50:37 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-02-26 08:50:37 +0000 |
commit | f1d16bc0076de863c4a419c555079016280752fa (patch) | |
tree | 1de4b8d82772bc2bb587f0364b0029f33511e16d /test | |
parent | 899f06612a4768538bf23faf5e4b0f4377c6d399 (diff) | |
download | redmine-f1d16bc0076de863c4a419c555079016280752fa.tar.gz redmine-f1d16bc0076de863c4a419c555079016280752fa.zip |
Test that AuthSourceLdap#authenticate returns valid User attributes only.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3491 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/auth_source_ldap_test.rb | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb index bf868929e..f78d6452f 100644 --- a/test/unit/auth_source_ldap_test.rb +++ b/test/unit/auth_source_ldap_test.rb @@ -42,25 +42,18 @@ class AuthSourceLdapTest < ActiveSupport::TestCase end context 'with a valid LDAP user' do - should 'return the firstname user attributes' do + should 'return the user attributes' do response = @auth.authenticate('example1','123456') assert response.is_a?(Array), "An array was not returned" assert response.first.present?, "No user data returned" - assert_equal 'Example', response.first[:firstname] - end - - should 'return the lastname user attributes' do - response = @auth.authenticate('example1','123456') - assert response.is_a?(Array), "An array was not returned" - assert response.first.present?, "No user data returned" - assert_equal 'One', response.first[:lastname] - end - - should 'return mail user attributes' do - response = @auth.authenticate('example1','123456') - assert response.is_a?(Array), "An array was not returned" - assert response.first.present?, "No user data returned" - assert_equal 'example1@redmine.org', response.first[:mail] + attributes = response.first + assert_equal 'Example', attributes[:firstname] + assert_equal 'One', attributes[:lastname] + assert_equal 'example1@redmine.org', attributes[:mail] + assert_equal @auth.id, attributes[:auth_source_id] + attributes.keys.each do |attribute| + assert User.new.respond_to?("#{attribute}="), "Unexpected :#{attribute} attribute returned" + end end end |