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
41f46bfa
Commit
41f46bfa
authored
Sep 03, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic tests for LDAP::Access.update_permissions
parent
a68b1963
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+30
-1
No files found.
spec/lib/gitlab/ldap/access_spec.rb
View file @
41f46bfa
...
...
@@ -32,7 +32,37 @@ describe Gitlab::LDAP::Access do
end
describe
:update_permissions
do
subject
{
access
.
update_permissions
(
user
)
}
before
do
Gitlab
.
config
.
ldap
[
'enabled'
]
=
true
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
=
false
Gitlab
.
config
.
ldap
[
'group_base'
]
=
'something'
Gitlab
.
config
.
ldap
[
'admin_group'
]
=
''
end
it
"syncs ssh keys if enabled by configuration"
do
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
=
true
expect
(
access
).
to
receive
(
:update_ssh_keys
).
with
(
user
).
once
subject
end
it
"does not update group permissions without a group base configured"
do
Gitlab
.
config
.
ldap
[
'group_base'
]
=
''
expect
(
access
).
not_to
receive
(
:update_ldap_group_links
).
with
(
user
)
subject
end
it
"does update admin group permissions if admin group is configured"
do
Gitlab
.
config
.
ldap
[
'admin_group'
]
=
'NSA'
access
.
stub
(
:update_ldap_group_links
)
expect
(
access
).
to
receive
(
:update_admin_status
).
with
(
user
)
subject
end
end
describe
:update_ssh_keys
do
...
...
@@ -79,7 +109,6 @@ describe Gitlab::LDAP::Access do
end
context
'user has at least one LDAPKey'
do
it
"should remove a SSH key if it is no longer in LDAP"
do
entry
=
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
}
:
\n
"
)
Gitlab
::
LDAP
::
Adapter
.
any_instance
.
stub
(
:user
)
{
Gitlab
::
LDAP
::
Person
.
new
(
entry
)
}
...
...
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