Commit 62b2360f authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'sy-add-status-mutation-spec' into 'master'

Add API test for AlertManagement::Alert status mutation

See merge request gitlab-org/gitlab!31668
parents a46ef0ce 578b0c2c
# frozen_string_literal: true
require 'spec_helper'
describe 'Setting the status of an alert' do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:alert) { create(:alert_management_alert, project: project) }
let(:input) { { status: 'ACKNOWLEDGED' } }
let(:mutation) do
variables = {
project_path: project.full_path,
iid: alert.iid.to_s
}
graphql_mutation(:update_alert_status, variables.merge(input),
<<~QL
clientMutationId
errors
alert {
iid
status
}
QL
)
end
let(:mutation_response) { graphql_mutation_response(:update_alert_status) }
before do
project.add_developer(user)
end
it 'updates the status of the alert' do
post_graphql_mutation(mutation, current_user: user)
expect(response).to have_gitlab_http_status(:success)
expect(mutation_response['alert']['status']).to eq(input[:status])
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