Commit 1de7d11e authored by Vitali Tatarintev's avatar Vitali Tatarintev

Add a changelog entry

parent 59cb9301
---
title: Prevents HttpIntegration.payload_attribute_mapping from being reset when it was not a part of a GraphQL mutation input.
merge_request: 55511
author:
type: fixed
...@@ -48,10 +48,11 @@ RSpec.describe 'Updating an existing HTTP Integration' do ...@@ -48,10 +48,11 @@ RSpec.describe 'Updating an existing HTTP Integration' do
let(:mutation_response) { graphql_mutation_response(:http_integration_update) } let(:mutation_response) { graphql_mutation_response(:http_integration_update) }
shared_examples 'ignoring the custom mapping' do shared_examples 'ignoring the custom mapping' do
it 'updates integration without the custom mapping params' do it 'updates integration without the custom mapping params', :aggregate_failures do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
expect(response).to have_gitlab_http_status(:success) expect(response).to have_gitlab_http_status(:success)
integration.reload
expect(integration.payload_example).to eq({}) expect(integration.payload_example).to eq({})
expect(integration.payload_attribute_mapping).to eq({}) expect(integration.payload_attribute_mapping).to eq({})
end end
...@@ -67,6 +68,26 @@ RSpec.describe 'Updating an existing HTTP Integration' do ...@@ -67,6 +68,26 @@ RSpec.describe 'Updating an existing HTTP Integration' do
it_behaves_like 'validating the payload_example' it_behaves_like 'validating the payload_example'
it_behaves_like 'validating the payload_attribute_mappings' it_behaves_like 'validating the payload_attribute_mappings'
it 'updates the custom mapping params', :aggregate_failures do
post_graphql_mutation(mutation, current_user: current_user)
expect(response).to have_gitlab_http_status(:success)
integration.reload
expect(integration.payload_example).to eq(Gitlab::Json.parse(payload_example))
expect(integration.payload_attribute_mapping).to eq(
'start_time' => {
'label' => 'Start time',
'path' => %w[started_at],
'type' => 'datetime'
},
'title' => {
'label' => nil,
'path' => %w[alert name],
'type' => 'string'
}
)
end
context 'when the custom mappings attributes are not part of the mutation variables' do context 'when the custom mappings attributes are not part of the mutation variables' do
let_it_be(:payload_example) do let_it_be(:payload_example) do
{ 'alert' => { 'name' => 'Test alert', 'desc' => 'Description' } } { 'alert' => { 'name' => 'Test alert', 'desc' => 'Description' } }
...@@ -100,7 +121,7 @@ RSpec.describe 'Updating an existing HTTP Integration' do ...@@ -100,7 +121,7 @@ RSpec.describe 'Updating an existing HTTP Integration' do
end end
end end
it 'does not resets the custom mapping attributes', :aggregate_failures do it 'does not reset the custom mapping attributes', :aggregate_failures do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
integration_response = mutation_response['integration'] integration_response = mutation_response['integration']
......
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