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
d88c4c12
Commit
d88c4c12
authored
May 25, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for group creation and remove duplicated test
parent
32e3955b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
lib/api/groups.rb
lib/api/groups.rb
+3
-0
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+23
-15
No files found.
lib/api/groups.rb
View file @
d88c4c12
...
...
@@ -90,6 +90,9 @@ module API
group_access:
params
.
delete
(
:ldap_access
)
}
# EE
authenticated_as_admin!
if
params
[
:shared_runners_minutes_limit
]
group
=
::
Groups
::
CreateService
.
new
(
current_user
,
declared_params
(
include_missing:
false
)).
execute
if
group
.
persisted?
...
...
spec/requests/api/groups_spec.rb
View file @
d88c4c12
...
...
@@ -494,23 +494,31 @@ describe API::Groups do
group_attributes
=
attributes_for
(
:group
,
ldap_cn:
'ldap-group'
,
ldap_access:
Gitlab
::
Access
::
DEVELOPER
)
expect
{
post
api
(
"/groups"
,
admin
),
group_attributes
}.
to
change
{
LdapGroupLink
.
count
}.
by
(
1
)
end
end
end
describe
"PUT /groups"
do
context
"when authenticated as user without group permissions"
do
it
"does not create group"
do
put
api
(
"/groups/
#{
group2
.
id
}
"
,
user1
),
attributes_for
(
:group
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
# EE
context
'when shared_runners_minutes_limit is given'
do
context
'when the current user is not an admin'
do
it
"does not create a group with shared_runners_minutes_limit"
do
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
context
"when authenticated as user with group permissions"
do
it
"updates group"
do
group2
.
update
(
owner:
user2
)
put
api
(
"/groups/
#{
group2
.
id
}
"
,
user2
),
{
name:
'Renamed'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
group2
.
reload
.
name
).
to
eq
(
'Renamed'
)
post
api
(
"/groups"
,
user3
),
group
expect
(
response
).
to
have_http_status
(
403
)
end
end
context
'when the current user is an admin'
do
it
"creates a group with shared_runners_minutes_limit"
do
group
=
attributes_for
(
:group
,
{
shared_runners_minutes_limit:
133
})
post
api
(
"/groups"
,
admin
),
group
created_group
=
Group
.
find
(
json_response
[
'id'
])
expect
(
response
).
to
have_http_status
(
201
)
expect
(
created_group
.
shared_runners_minutes_limit
).
to
eq
(
133
)
end
end
end
end
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