BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d14f080c
Commit
d14f080c
authored
Apr 04, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary LDAP tests from SAML tests
parent
1a168279
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
59 deletions
+7
-59
user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+7
-59
No files found.
spec/lib/gitlab/saml/user_spec.rb
View file @
d14f080c
...
...
@@ -23,6 +23,12 @@ describe Gitlab::Saml::User, lib: true do
allow
(
Gitlab
::
LDAP
::
Config
).
to
receive_messages
(
messages
)
end
def
stub_saml_config
(
messages
)
allow
(
Gitlab
::
Saml
::
Config
).
to
receive_messages
(
messages
)
end
before
{
stub_saml_config
({
options:
{
name:
'saml'
,
args:
{}
}
})
}
describe
'account exists on server'
do
before
{
stub_omniauth_config
({
allow_single_sign_on:
[
'saml'
],
auto_link_saml_user:
true
})
}
context
'and should bind with SAML'
do
...
...
@@ -138,7 +144,7 @@ describe Gitlab::Saml::User, lib: true do
end
describe
'blocking'
do
before
{
stub_omniauth_config
({
allow_s
aml_sign_up:
true
,
auto_link_saml_user:
true
})
}
before
{
stub_omniauth_config
({
allow_s
ingle_sign_on:
[
'saml'
]
,
auto_link_saml_user:
true
})
}
context
'signup with SAML only'
do
context
'dont block on create'
do
...
...
@@ -162,64 +168,6 @@ describe Gitlab::Saml::User, lib: true do
end
end
context
'signup with linked omniauth and LDAP account'
do
before
do
stub_omniauth_config
(
auto_link_ldap_user:
true
)
allow
(
ldap_user
).
to
receive
(
:uid
)
{
uid
}
allow
(
ldap_user
).
to
receive
(
:username
)
{
uid
}
allow
(
ldap_user
).
to
receive
(
:email
)
{
[
'johndoe@example.com'
,
'john2@example.com'
]
}
allow
(
ldap_user
).
to
receive
(
:dn
)
{
'uid=user1,ou=People,dc=example'
}
allow
(
saml_user
).
to
receive
(
:ldap_person
).
and_return
(
ldap_user
)
end
context
"and no account for the LDAP user"
do
context
'dont block on create (LDAP)'
do
before
{
allow_any_instance_of
(
Gitlab
::
LDAP
::
Config
).
to
receive_messages
(
block_auto_created_users:
false
)
}
it
do
saml_user
.
save
expect
(
gl_user
).
to
be_valid
expect
(
gl_user
).
not_to
be_blocked
end
end
context
'block on create (LDAP)'
do
before
{
allow_any_instance_of
(
Gitlab
::
LDAP
::
Config
).
to
receive_messages
(
block_auto_created_users:
true
)
}
it
do
saml_user
.
save
expect
(
gl_user
).
to
be_valid
expect
(
gl_user
).
to
be_blocked
end
end
end
context
'and LDAP user has an account already'
do
let!
(
:existing_user
)
{
create
(
:omniauth_user
,
email:
'john@example.com'
,
extern_uid:
'uid=user1,ou=People,dc=example'
,
provider:
'ldapmain'
,
username:
'john'
)
}
context
'dont block on create (LDAP)'
do
before
{
allow_any_instance_of
(
Gitlab
::
LDAP
::
Config
).
to
receive_messages
(
block_auto_created_users:
false
)
}
it
do
saml_user
.
save
expect
(
gl_user
).
to
be_valid
expect
(
gl_user
).
not_to
be_blocked
end
end
context
'block on create (LDAP)'
do
before
{
allow_any_instance_of
(
Gitlab
::
LDAP
::
Config
).
to
receive_messages
(
block_auto_created_users:
true
)
}
it
do
saml_user
.
save
expect
(
gl_user
).
to
be_valid
expect
(
gl_user
).
not_to
be_blocked
end
end
end
end
context
'sign-in'
do
before
do
saml_user
.
save
...
...
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