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
98adf69c
Commit
98adf69c
authored
Feb 22, 2020
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for avatar in group create and update API, add specs
parent
1c6e59fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
lib/api/helpers/groups_helpers.rb
lib/api/helpers/groups_helpers.rb
+2
-0
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+25
-0
No files found.
lib/api/helpers/groups_helpers.rb
View file @
98adf69c
...
@@ -11,6 +11,8 @@ module API
...
@@ -11,6 +11,8 @@ module API
optional
:visibility
,
type:
String
,
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'The visibility of the group'
desc:
'The visibility of the group'
# TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960
optional
:avatar
,
type:
File
,
desc:
'Avatar image for the group'
# rubocop:disable Scalability/FileUploads
optional
:share_with_group_lock
,
type:
Boolean
,
desc:
'Prevent sharing a project with another group within this group'
optional
:share_with_group_lock
,
type:
Boolean
,
desc:
'Prevent sharing a project with another group within this group'
optional
:require_two_factor_authentication
,
type:
Boolean
,
desc:
'Require all users in this group to setup Two-factor authentication'
optional
:require_two_factor_authentication
,
type:
Boolean
,
desc:
'Require all users in this group to setup Two-factor authentication'
optional
:two_factor_grace_period
,
type:
Integer
,
desc:
'Time before Two-factor authentication is enforced'
optional
:two_factor_grace_period
,
type:
Integer
,
desc:
'Time before Two-factor authentication is enforced'
...
...
spec/requests/api/groups_spec.rb
View file @
98adf69c
...
@@ -570,6 +570,19 @@ describe API::Groups do
...
@@ -570,6 +570,19 @@ describe API::Groups do
expect
(
json_response
[
'default_branch_protection'
]).
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
expect
(
json_response
[
'default_branch_protection'
]).
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
end
end
it
'updates avatar'
do
group_param
=
{
avatar:
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
put
api
(
"/groups/
#{
group1
.
id
}
"
,
user1
),
params:
group_param
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
'http://localhost/uploads/'
\
'-/system/group/avatar/'
\
"
#{
group1
.
id
}
/banana_sample.gif"
)
end
it
'returns 404 for a non existing group'
do
it
'returns 404 for a non existing group'
do
put
api
(
'/groups/1328'
,
user1
),
params:
{
name:
new_group_name
}
put
api
(
'/groups/1328'
,
user1
),
params:
{
name:
new_group_name
}
...
@@ -988,6 +1001,18 @@ describe API::Groups do
...
@@ -988,6 +1001,18 @@ describe API::Groups do
expect
(
json_response
[
"visibility"
]).
to
eq
(
Gitlab
::
VisibilityLevel
.
string_level
(
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_group_visibility
))
expect
(
json_response
[
"visibility"
]).
to
eq
(
Gitlab
::
VisibilityLevel
.
string_level
(
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_group_visibility
))
end
end
it
"uploads avatar for a group"
do
group
=
attributes_for_group_api
request_access_enabled:
false
group
.
merge!
(
avatar:
fixture_file_upload
(
'spec/fixtures/banana_sample.gif'
,
'image/gif'
))
post
api
(
"/groups"
,
user3
),
params:
group
group_id
=
json_response
[
'id'
]
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
'http://localhost/uploads/'
\
'-/system/group/avatar/'
\
"
#{
group_id
}
/banana_sample.gif"
)
end
it
"creates a nested group"
do
it
"creates a nested group"
do
parent
=
create
(
:group
)
parent
=
create
(
:group
)
parent
.
add_owner
(
user3
)
parent
.
add_owner
(
user3
)
...
...
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