diff options
author | Patricio Cano <suprnova32@gmail.com> | 2015-12-22 13:00:41 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2015-12-22 13:23:35 -0500 |
commit | 1d3889eb465655af5f7e3e6c3af9f3f529e6c9b5 (patch) | |
tree | 2dc76089722d3f5d1bb34de44bb246ba96faf764 /spec/lib | |
parent | 1cf45407d3be9e9767d27e55b6f3e2e0d8dea36f (diff) | |
download | gitlab-ce-1d3889eb465655af5f7e3e6c3af9f3f529e6c9b5.tar.gz |
Fix identity and user retrieval when special characters are used
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ldap/user_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb index 3bba5e2efa2..1e755259dae 100644 --- a/spec/lib/gitlab/ldap/user_spec.rb +++ b/spec/lib/gitlab/ldap/user_spec.rb @@ -42,6 +42,21 @@ describe Gitlab::LDAP::User, lib: true do end end + describe '.find_by_uid_and_provider' do + it 'retrieves the correct user' do + special_info = { + name: 'John Åström', + email: 'john@example.com', + nickname: 'jastrom' + } + special_hash = OmniAuth::AuthHash.new(uid: 'CN=John Åström,CN=Users,DC=Example,DC=com', provider: 'ldapmain', info: special_info) + special_chars_user = described_class.new(special_hash) + user = special_chars_user.save + + expect(described_class.find_by_uid_and_provider(special_hash.uid, special_hash.provider)).to eq user + end + end + describe :find_or_create do it "finds the user if already existing" do create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain') |