Commit 5c93da67 authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-ms-teams-branch-setting' into 'master'

Fix missing branches_to_be_notified setting for Microsoft Teams

See merge request gitlab-org/gitlab!23571
parents e3c1b6fb 34e6018d
---
title: Fix missing API notification argument for Microsoft Teams
merge_request: 23571
author: Seiji Suenaga
type: fixed
...@@ -675,6 +675,12 @@ module API ...@@ -675,6 +675,12 @@ module API
type: String, type: String,
desc: 'The Microsoft Teams webhook. e.g. https://outlook.office.com/webhook/…' desc: 'The Microsoft Teams webhook. e.g. https://outlook.office.com/webhook/…'
}, },
{
required: false,
name: :branches_to_be_notified,
type: String,
desc: 'Branches for which notifications are to be sent'
},
chat_notification_flags chat_notification_flags
].flatten, ].flatten,
'mattermost' => [ 'mattermost' => [
......
...@@ -241,10 +241,42 @@ describe API::Services do ...@@ -241,10 +241,42 @@ describe API::Services do
end end
it 'accepts a username for update' do it 'accepts a username for update' do
put api("/projects/#{project.id}/services/mattermost", user), params: params.merge(username: 'new_username') put api("/projects/#{project.id}/services/#{service_name}", user), params: params.merge(username: 'new_username')
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response['properties']['username']).to eq('new_username') expect(json_response['properties']['username']).to eq('new_username')
end end
end end
describe 'Microsoft Teams service' do
let(:service_name) { 'microsoft-teams' }
let(:params) do
{
webhook: 'https://hook.example.com',
branches_to_be_notified: 'default',
notify_only_broken_pipelines: false
}
end
before do
project.create_microsoft_teams_service(
active: true,
properties: params
)
end
it 'accepts branches_to_be_notified for update' do
put api("/projects/#{project.id}/services/#{service_name}", user), params: params.merge(branches_to_be_notified: 'all')
expect(response).to have_gitlab_http_status(200)
expect(json_response['properties']['branches_to_be_notified']).to eq('all')
end
it 'accepts notify_only_broken_pipelines for update' do
put api("/projects/#{project.id}/services/#{service_name}", user), params: params.merge(notify_only_broken_pipelines: true)
expect(response).to have_gitlab_http_status(200)
expect(json_response['properties']['notify_only_broken_pipelines']).to eq(true)
end
end
end end
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