Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c52fee70
Commit
c52fee70
authored
Sep 09, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test overriding LDAP attributes
parent
909a8443
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
spec/lib/gitlab/ldap/auth_hash_spec.rb
spec/lib/gitlab/ldap/auth_hash_spec.rb
+65
-0
No files found.
spec/lib/gitlab/ldap/auth_hash_spec.rb
0 → 100644
View file @
c52fee70
require
'spec_helper'
describe
Gitlab
::
LDAP
::
AuthHash
do
let
(
:auth_hash
)
do
Gitlab
::
LDAP
::
AuthHash
.
new
(
OmniAuth
::
AuthHash
.
new
(
uid:
'123456'
,
provider:
'ldapmain'
,
info:
info
,
extra:
{
raw_info:
raw_info
}
)
)
end
let
(
:info
)
do
{
name:
'Smith, J.'
,
email:
'johnsmith@example.com'
,
nickname:
'123456'
}
end
let
(
:raw_info
)
do
{
uid:
'123456'
,
email:
'johnsmith@example.com'
,
cn:
'Smith, J.'
,
fullName:
'John Smith'
}
end
context
"without overridden attributes"
do
it
"has the correct username"
do
expect
(
auth_hash
.
username
).
to
eq
(
"123456"
)
end
it
"has the correct name"
do
expect
(
auth_hash
.
name
).
to
eq
(
"Smith, J."
)
end
end
context
"with overridden attributes"
do
let
(
:attributes
)
do
{
username:
[
'mail'
,
'email'
],
name:
'fullName'
}
end
before
do
allow_any_instance_of
(
Gitlab
::
LDAP
::
Config
).
to
receive
(
:attributes
).
and_return
(
attributes
)
end
it
"has the correct username"
do
expect
(
auth_hash
.
username
).
to
eq
(
"johnsmith@example.com"
)
end
it
"has the correct name"
do
expect
(
auth_hash
.
name
).
to
eq
(
"John Smith"
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment