Commit 34e6018d authored by Seiji Suenaga's avatar Seiji Suenaga

Fix missing branches_to_be_notified setting for Microsoft Teams

Setting can't be inherited from the shared chat_notification_settings definition because the MS Teams service doesn't its :username or :channel settings.
parent eeba9db6
---
title: Fix missing API notification argument for Microsoft Teams
merge_request: 23571
author: Seiji Suenaga
type: fixed
......@@ -675,6 +675,12 @@ module API
type: String,
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
].flatten,
'mattermost' => [
......
......@@ -241,10 +241,42 @@ describe API::Services do
end
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(json_response['properties']['username']).to eq('new_username')
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
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