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
f8db7590
Commit
f8db7590
authored
Sep 26, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more specs and fixes
parent
2424df1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
3 deletions
+50
-3
features/steps/groups.rb
features/steps/groups.rb
+1
-1
spec/ee/spec/lib/ee/gitlab/ldap/sync/group_spec.rb
spec/ee/spec/lib/ee/gitlab/ldap/sync/group_spec.rb
+47
-0
spec/factories/groups.rb
spec/factories/groups.rb
+2
-2
No files found.
features/steps/groups.rb
View file @
f8db7590
...
...
@@ -157,7 +157,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step
'I see a new LDAP synchronization listed'
do
expect
(
page
).
not_to
have_content
(
'No
synchronizations yet
'
)
expect
(
page
).
not_to
have_content
(
'No
LDAP synchronizations
'
)
expect
(
page
).
to
have_content
(
'As Developer on ldap server'
)
end
...
...
spec/ee/spec/lib/ee/gitlab/ldap/sync/group_spec.rb
View file @
f8db7590
...
...
@@ -371,4 +371,51 @@ describe EE::Gitlab::LDAP::Sync::Group do
end
end
end
context
'filter'
do
describe
'#update_permissions'
do
before
do
# Safe-check because some permissions are removed when `Group#ldap_synced?`
# is true (e.g. in `GroupPolicy`).
expect
(
group
).
to
be_ldap_synced
allow
(
EE
::
Gitlab
::
LDAP
::
UserFilter
).
to
receive
(
:filter
).
and_return
([
user_dn
(
user
.
username
)])
group
.
start_ldap_sync
end
after
do
group
.
finish_ldap_sync
end
let
(
:group
)
do
create
(
:group_with_ldap_group_filter_link
,
:access_requestable
,
group_access:
::
Gitlab
::
Access
::
DEVELOPER
)
end
let
(
:sync_group
)
{
described_class
.
new
(
group
,
proxy
(
adapter
))
}
context
'with all functionality against one LDAP group type'
do
context
'with basic add/update actions'
do
let
(
:ldap_group1
)
{
ldap_group_entry
(
user_dn
(
user
.
username
))
}
it
'does not update permissions unless ldap sync status is started'
do
group
.
finish_ldap_sync
expect
(
Rails
.
logger
)
.
to
receive
(
:warn
).
with
(
/status must be 'started' before updating permissions/
)
sync_group
.
update_permissions
end
it
'adds new members and sets ldap attribute to true'
do
sync_group
.
update_permissions
expect
(
group
.
members
.
pluck
(
:user_id
)).
to
include
(
user
.
id
)
expect
(
group
.
members
.
find_by
(
user_id:
user
.
id
).
ldap?
).
to
be_truthy
end
end
end
end
end
end
spec/factories/groups.rb
View file @
f8db7590
...
...
@@ -37,7 +37,7 @@ FactoryGirl.define do
factory
:group_with_ldap_group_link
do
after
(
:create
)
do
|
group
,
evaluator
|
group
.
ldap_group_links
<<
create
(
:ldap_group_link
,
:ldap_group_link
,
cn:
evaluator
.
cn
,
group_access:
evaluator
.
group_access
,
provider:
evaluator
.
provider
...
...
@@ -48,7 +48,7 @@ FactoryGirl.define do
factory
:group_with_ldap_group_filter_link
do
after
(
:create
)
do
|
group
,
evaluator
|
group
.
ldap_group_links
<<
create
(
:ldap_group_link
,
:ldap_group_link
,
filter:
'(a=b)'
,
cn:
nil
,
group_access:
evaluator
.
group_access
,
...
...
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