Fix acceptance of username for Mattermost service update via API
This commit is contained in:
parent
0c3877a488
commit
12d622eb99
4 changed files with 33 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix acceptance of username for Mattermost service update
|
||||
merge_request: 15275
|
||||
author:
|
||||
type: fixed
|
|
@ -572,7 +572,7 @@ Parameters:
|
|||
| Attribute | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `token` | string | yes | The Mattermost token |
|
||||
|
||||
| `username` | string | no | The username to use to post the message |
|
||||
|
||||
### Delete Mattermost slash command service
|
||||
|
||||
|
|
|
@ -522,6 +522,12 @@ module API
|
|||
name: :webhook,
|
||||
type: String,
|
||||
desc: 'The Mattermost webhook. e.g. http://mattermost_host/hooks/...'
|
||||
},
|
||||
{
|
||||
required: false,
|
||||
name: :username,
|
||||
type: String,
|
||||
desc: 'The username to use to post the message'
|
||||
}
|
||||
],
|
||||
'teamcity' => [
|
||||
|
|
|
@ -175,4 +175,25 @@ describe API::Services do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Mattermost service' do
|
||||
let(:service_name) { 'mattermost' }
|
||||
let(:params) do
|
||||
{ webhook: 'https://hook.example.com', username: 'username' }
|
||||
end
|
||||
|
||||
before do
|
||||
project.create_mattermost_service(
|
||||
active: true,
|
||||
properties: params
|
||||
)
|
||||
end
|
||||
|
||||
it 'accepts a username for update' do
|
||||
put api("/projects/#{project.id}/services/mattermost", user), params.merge(username: 'new_username')
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response['properties']['username']).to eq('new_username')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue