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
a790fbd0
Commit
a790fbd0
authored
Aug 23, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub proxy for specs
parent
d41098b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
spec/ee/spec/lib/ee/gitlab/ldap/user_spec.rb
spec/ee/spec/lib/ee/gitlab/ldap/user_spec.rb
+1
-6
spec/lib/gitlab/ldap/user_spec.rb
spec/lib/gitlab/ldap/user_spec.rb
+1
-0
spec/support/ldap_helpers.rb
spec/support/ldap_helpers.rb
+6
-0
No files found.
spec/ee/spec/lib/ee/gitlab/ldap/user_spec.rb
View file @
a790fbd0
...
...
@@ -15,11 +15,10 @@ describe Gitlab::LDAP::User do
let
(
:auth_hash
)
do
OmniAuth
::
AuthHash
.
new
(
uid:
'uid=john,ou=people,dc=example,dc=com'
,
provider:
'ldapmain'
,
info:
info
)
end
let
(
:adapter
)
{
ldap_adapter
}
let
(
:group_cn
)
{
'foo'
}
let
(
:group_member_dns
)
{
[
auth_hash
.
uid
]
}
let
(
:external_groups
)
{
[]
}
let
(
:fake_proxy
)
{
double
(
:proxy
,
adapter:
adapt
er
)
}
let
!
(
:fake_proxy
)
{
fake_ldap_sync_proxy
(
auth_hash
.
provid
er
)
}
before
do
allow
(
fake_proxy
).
to
receive
(
:dns_for_group_cn
).
with
(
group_cn
).
and_return
(
group_member_dns
)
...
...
@@ -31,10 +30,6 @@ describe Gitlab::LDAP::User do
end
describe
'#initialize'
do
before
do
expect
(
::
EE
::
Gitlab
::
LDAP
::
Sync
::
Proxy
).
to
receive
(
:open
).
with
(
auth_hash
.
provider
).
and_yield
(
fake_proxy
)
end
context
'when the user is in an external group'
do
let
(
:external_groups
)
{
[
group_cn
]
}
...
...
spec/lib/gitlab/ldap/user_spec.rb
View file @
a790fbd0
...
...
@@ -26,6 +26,7 @@ describe Gitlab::LDAP::User do
let
(
:auth_hash_upper_case
)
do
OmniAuth
::
AuthHash
.
new
(
uid:
'my-uid'
,
provider:
'ldapmain'
,
info:
info_upper_case
)
end
let!
(
:fake_proxy
)
{
fake_ldap_sync_proxy
(
'ldapmain'
)
}
describe
'#changed?'
do
it
"marks existing ldap user as changed"
do
...
...
spec/support/ldap_helpers.rb
View file @
a790fbd0
...
...
@@ -5,6 +5,12 @@ module LdapHelpers
::
Gitlab
::
LDAP
::
Adapter
.
new
(
provider
,
ldap
)
end
def
fake_ldap_sync_proxy
(
provider
)
fake_proxy
=
double
(
:proxy
,
adapter:
ldap_adapter
)
allow
(
::
EE
::
Gitlab
::
LDAP
::
Sync
::
Proxy
).
to
receive
(
:open
).
with
(
provider
).
and_yield
(
fake_proxy
)
fake_proxy
end
def
user_dn
(
uid
)
"uid=
#{
uid
}
,ou=users,dc=example,dc=com"
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