@@ -42,25 +42,18 class AuthSourceLdapTest < ActiveSupport::TestCase | |||||
42 | end |
|
42 | end | |
43 |
|
43 | |||
44 | context 'with a valid LDAP user' do |
|
44 | context 'with a valid LDAP user' do | |
45 |
should 'return the |
|
45 | should 'return the user attributes' do | |
46 | response = @auth.authenticate('example1','123456') |
|
46 | response = @auth.authenticate('example1','123456') | |
47 | assert response.is_a?(Array), "An array was not returned" |
|
47 | assert response.is_a?(Array), "An array was not returned" | |
48 | assert response.first.present?, "No user data returned" |
|
48 | assert response.first.present?, "No user data returned" | |
49 | assert_equal 'Example', response.first[:firstname] |
|
49 | attributes = response.first | |
50 | end |
|
50 | assert_equal 'Example', attributes[:firstname] | |
51 |
|
51 | assert_equal 'One', attributes[:lastname] | ||
52 | should 'return the lastname user attributes' do |
|
52 | assert_equal 'example1@redmine.org', attributes[:mail] | |
53 | response = @auth.authenticate('example1','123456') |
|
53 | assert_equal @auth.id, attributes[:auth_source_id] | |
54 | assert response.is_a?(Array), "An array was not returned" |
|
54 | attributes.keys.each do |attribute| | |
55 | assert response.first.present?, "No user data returned" |
|
55 | assert User.new.respond_to?("#{attribute}="), "Unexpected :#{attribute} attribute returned" | |
56 | assert_equal 'One', response.first[:lastname] |
|
56 | end | |
57 | end |
|
|||
58 |
|
||||
59 | should 'return mail user attributes' do |
|
|||
60 | response = @auth.authenticate('example1','123456') |
|
|||
61 | assert response.is_a?(Array), "An array was not returned" |
|
|||
62 | assert response.first.present?, "No user data returned" |
|
|||
63 | assert_equal 'example1@redmine.org', response.first[:mail] |
|
|||
64 | end |
|
57 | end | |
65 | end |
|
58 | end | |
66 |
|
59 |
General Comments 0
You need to be logged in to leave comments.
Login now