diff options
| author | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 14:53:59 +0200 |
|---|---|---|
| committer | Jan-Willem van der Meer <mail@jewilmeer.nl> | 2014-09-08 14:53:59 +0200 |
| commit | 11bb67c3c6d4b90629744f8a011121e35968c58b (patch) | |
| tree | 25c4251a65634cf86539a7bbf07f9bcf54efe6ed /spec | |
| parent | f27830fa4c11548279b5eed68e92b6f352ad4a9f (diff) | |
| download | gitlab-ce-11bb67c3c6d4b90629744f8a011121e35968c58b.tar.gz | |
Test authenticate method for Gitlab::LDAP::User
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/gitlab/ldap/user_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb index 4ddf6b3039f..d232cb20759 100644 --- a/spec/lib/gitlab/ldap/user_spec.rb +++ b/spec/lib/gitlab/ldap/user_spec.rb @@ -35,4 +35,20 @@ describe Gitlab::LDAP::User do expect{ gl_user.find_or_create(auth) }.to change{ User.count }.by(1) end end + + describe "authenticate" do + let(:login) { 'john' } + let(:password) { 'my-secret' } + + before { + Gitlab.config.ldap['enabled'] = true + Gitlab.config.ldap['user_filter'] = 'employeeType=developer' + } + after { Gitlab.config.ldap['enabled'] = false } + + it "send an authentication request to ldap" do + expect( Gitlab::LDAP::User.adapter ).to receive(:bind_as) + Gitlab::LDAP::User.authenticate(login, password) + end + end end |
