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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f3cefb32
Commit
f3cefb32
authored
Sep 09, 2020
by
Blair Lunceford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for auto_link_user is true
parent
84c90b16
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
spec/lib/gitlab/auth/o_auth/user_spec.rb
spec/lib/gitlab/auth/o_auth/user_spec.rb
+29
-0
No files found.
spec/lib/gitlab/auth/o_auth/user_spec.rb
View file @
f3cefb32
...
...
@@ -251,6 +251,35 @@ RSpec.describe Gitlab::Auth::OAuth::User do
end
end
context
"with auto_link_user enabled for all providers"
do
before
do
stub_omniauth_config
(
auto_link_user:
true
)
end
context
"and a current GitLab user with a matching email"
do
let!
(
:existing_user
)
{
create
(
:user
,
email:
'john@mail.com'
,
username:
'john'
)
}
it
"adds the OmniAuth identity to the GitLab user account"
do
oauth_user
.
save
expect
(
gl_user
).
to
be_valid
expect
(
gl_user
.
username
).
to
eql
'john'
expect
(
gl_user
.
email
).
to
eql
'john@mail.com'
expect
(
gl_user
.
identities
.
length
).
to
be
1
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
(
[
{
provider:
'twitter'
,
extern_uid:
uid
}
]
)
end
end
context
"and no current GitLab user with a matching email"
do
include_examples
"to verify compliance with allow_single_sign_on"
end
end
context
"with auto_link_ldap_user disabled (default)"
do
before
do
stub_omniauth_config
(
auto_link_ldap_user:
false
)
...
...
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