Commit e12af2f3 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch '22453-ability-to-set-update-avatar_url-for-groups-api' into 'master'

Add doc and test for set group avatar REST API

See merge request gitlab-org/gitlab!47577
parents 67b05485 909aff99
...@@ -941,6 +941,19 @@ The `shared_runners_setting` attribute determines whether shared runners are ena ...@@ -941,6 +941,19 @@ The `shared_runners_setting` attribute determines whether shared runners are ena
| `disabled_with_override` | Disables shared runners for all projects and subgroups in this group, but allows subgroups to override this setting. | | `disabled_with_override` | Disables shared runners for all projects and subgroups in this group, but allows subgroups to override this setting. |
| `disabled_and_unoverridable` | Disables shared runners for all projects and subgroups in this group, and prevents subgroups from overriding this setting. | | `disabled_and_unoverridable` | Disables shared runners for all projects and subgroups in this group, and prevents subgroups from overriding this setting. |
### Upload a group avatar
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/36681) in GitLab 12.9.
To upload an avatar file from your file system, use the `--form` argument. This causes
curl to post data using the header `Content-Type: multipart/form-data`. The
`file=` parameter must point to a file on your file system and be preceded by
`@`. For example:
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/22" --form "avatar=@/tmp/example.png"
```
## Remove group ## Remove group
Only available to group owners and administrators. Only available to group owners and administrators.
......
...@@ -54,7 +54,7 @@ RSpec.describe API::Groups do ...@@ -54,7 +54,7 @@ RSpec.describe API::Groups do
it_behaves_like 'invalid file upload request' it_behaves_like 'invalid file upload request'
end end
context 'when file format is not supported' do context 'when file is too large' do
let(:file_path) { 'spec/fixtures/big-image.png' } let(:file_path) { 'spec/fixtures/big-image.png' }
let(:message) { 'is too big' } let(:message) { 'is too big' }
...@@ -661,6 +661,7 @@ RSpec.describe API::Groups do ...@@ -661,6 +661,7 @@ RSpec.describe API::Groups do
describe 'PUT /groups/:id' do describe 'PUT /groups/:id' do
let(:new_group_name) { 'New Group'} let(:new_group_name) { 'New Group'}
let(:file_path) { 'spec/fixtures/dk.png' }
it_behaves_like 'group avatar upload' do it_behaves_like 'group avatar upload' do
def make_upload_request def make_upload_request
...@@ -678,7 +679,8 @@ RSpec.describe API::Groups do ...@@ -678,7 +679,8 @@ RSpec.describe API::Groups do
request_access_enabled: true, request_access_enabled: true,
project_creation_level: "noone", project_creation_level: "noone",
subgroup_creation_level: "maintainer", subgroup_creation_level: "maintainer",
default_branch_protection: ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS default_branch_protection: ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS,
avatar: fixture_file_upload(file_path)
} }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -701,6 +703,7 @@ RSpec.describe API::Groups do ...@@ -701,6 +703,7 @@ RSpec.describe API::Groups do
expect(json_response['shared_projects']).to be_an Array expect(json_response['shared_projects']).to be_an Array
expect(json_response['shared_projects'].length).to eq(0) expect(json_response['shared_projects'].length).to eq(0)
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)
expect(json_response['avatar_url']).to end_with('dk.png')
end end
context 'updating the `default_branch_protection` attribute' do context 'updating the `default_branch_protection` attribute' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment