Commit adc742cc authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fix ldap tests. This was introduced in:

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13054

We need to take care of CE -> EE better here
parent fb77d8e6
......@@ -107,7 +107,7 @@ module Gitlab
end
def user_attributes
%W(#{config.uid} cn dn mail memberof) + config.attributes['username'] + config.attributes['email']
%W(#{config.uid} cn dn memberof) + config.attributes['username'] + config.attributes['email']
end
end
end
......
......@@ -43,7 +43,7 @@ describe Gitlab::LDAP::Adapter do
describe '#user_attributes' do
it 'appends EE-specific attributes' do
stub_ldap_config(uid: 'uid', sync_ssh_keys: 'sshPublicKey')
expect(adapter.user_attributes).to match_array(%w(uid dn cn mail sshPublicKey memberof))
expect(adapter.user_attributes).to match_array(%w(uid dn cn email mail memberof sAMAccountName sshPublicKey uid userPrincipalName userid))
end
end
end
......@@ -16,7 +16,7 @@ describe Gitlab::LDAP::Adapter do
expect(adapter).to receive(:ldap_search) do |arg|
expect(arg[:filter].to_s).to eq('(uid=johndoe)')
expect(arg[:base]).to eq('dc=example,dc=com')
expect(arg[:attributes]).to match(%w{uid cn dn uid userid sAMAccountName mail email userPrincipalName})
expect(arg[:attributes]).to match(%w{uid cn dn memberof uid userid sAMAccountName mail email userPrincipalName})
end.and_return({})
adapter.users('uid', 'johndoe')
......@@ -26,7 +26,7 @@ describe Gitlab::LDAP::Adapter do
expect(adapter).to receive(:ldap_search).with(
base: 'uid=johndoe,ou=users,dc=example,dc=com',
scope: Net::LDAP::SearchScope_BaseObject,
attributes: %w{uid cn dn uid userid sAMAccountName mail email userPrincipalName},
attributes: %w{uid cn dn memberof uid userid sAMAccountName mail email userPrincipalName},
filter: nil
).and_return({})
......@@ -63,7 +63,7 @@ describe Gitlab::LDAP::Adapter do
it 'uses the right uid attribute when non-default' do
stub_ldap_config(uid: 'sAMAccountName')
expect(adapter).to receive(:ldap_search).with(
hash_including(attributes: %w{sAMAccountName cn dn uid userid sAMAccountName mail email userPrincipalName})
hash_including(attributes: %w{sAMAccountName cn dn memberof uid userid sAMAccountName mail email userPrincipalName})
).and_return({})
adapter.users('sAMAccountName', 'johndoe')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment