Commit 17a6f3e3 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'djadmin-site-profile-graphql-updates' into 'master'

Update DAST site profile mutations to return payload

See merge request gitlab-org/gitlab!84257
parents 36dbaef0 1f66f68e
......@@ -1881,8 +1881,9 @@ Input type: `DastSiteProfileCreateInput`
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mutationdastsiteprofilecreateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationdastsiteprofilecreatedastsiteprofile"></a>`dastSiteProfile` | [`DastSiteProfile`](#dastsiteprofile) | Site Profile object. |
| <a id="mutationdastsiteprofilecreateerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
| <a id="mutationdastsiteprofilecreateid"></a>`id` | [`DastSiteProfileID`](#dastsiteprofileid) | ID of the site profile. |
| <a id="mutationdastsiteprofilecreateid"></a>`id` **{warning-solid}** | [`DastSiteProfileID`](#dastsiteprofileid) | **Deprecated:** use `dastSiteProfile.id` field. Deprecated in 14.10. |
### `Mutation.dastSiteProfileDelete`
......@@ -1927,8 +1928,9 @@ Input type: `DastSiteProfileUpdateInput`
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mutationdastsiteprofileupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationdastsiteprofileupdatedastsiteprofile"></a>`dastSiteProfile` | [`DastSiteProfile`](#dastsiteprofile) | Site profile object. |
| <a id="mutationdastsiteprofileupdateerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
| <a id="mutationdastsiteprofileupdateid"></a>`id` | [`DastSiteProfileID`](#dastsiteprofileid) | ID of the site profile. |
| <a id="mutationdastsiteprofileupdateid"></a>`id` **{warning-solid}** | [`DastSiteProfileID`](#dastsiteprofileid) | **Deprecated:** use `dastSiteProfile.id` field. Deprecated in 14.10. |
### `Mutation.dastSiteTokenCreate`
......@@ -10,7 +10,12 @@ module Mutations
field :id, SiteProfileID,
null: true,
description: 'ID of the site profile.'
description: 'ID of the site profile.',
deprecated: { reason: 'use `dastSiteProfile.id` field', milestone: '14.10' }
field :dast_site_profile, ::Types::DastSiteProfileType,
null: true,
description: 'Site Profile object.'
argument :full_path, GraphQL::Types::ID,
required: true,
......@@ -48,7 +53,7 @@ module Mutations
result = ::AppSec::Dast::SiteProfiles::CreateService.new(project, current_user).execute(**dast_site_profile_params)
{ id: result.payload.try(:to_global_id), errors: result.errors }
{ id: result.payload.try(:to_global_id), dast_site_profile: result.payload, errors: result.errors }
end
end
end
......
......@@ -10,7 +10,12 @@ module Mutations
field :id, SiteProfileID,
null: true,
description: 'ID of the site profile.'
description: 'ID of the site profile.',
deprecated: { reason: 'use `dastSiteProfile.id` field', milestone: '14.10' }
field :dast_site_profile, ::Types::DastSiteProfileType,
null: true,
description: 'Site profile object.'
argument :full_path, GraphQL::Types::ID,
required: false,
......@@ -55,7 +60,7 @@ module Mutations
result = ::AppSec::Dast::SiteProfiles::UpdateService.new(dast_site_profile.project, current_user).execute(**dast_site_profile_params)
{ id: result.payload.try(:to_global_id), errors: result.errors }
{ id: result.payload.try(:to_global_id), dast_site_profile: result.payload, errors: result.errors }
end
private
......
......@@ -114,6 +114,10 @@ RSpec.describe Mutations::DastSiteProfiles::Create do
expect(subject[:id]).to eq(dast_site_profile.to_global_id)
end
it 'returns the complete dast_site_profile' do
expect(subject[:dast_site_profile]).to eq(dast_site_profile)
end
it 'calls the dast_site_profile creation service' do
service = double(::AppSec::Dast::SiteProfiles::CreateService)
result = ServiceResponse.error(message: '')
......
......@@ -99,6 +99,10 @@ RSpec.describe Mutations::DastSiteProfiles::Update do
expect(dast_site_profile.secret_variables.map(&:key)).to include(Dast::SiteProfileSecretVariable::PASSWORD)
end
it 'returns the complete dast_site_profile' do
expect(subject[:dast_site_profile]).to eq(dast_site_profile)
end
context 'when secret variables already exist' do
let_it_be(:request_headers_variable) { create(:dast_site_profile_secret_variable, :request_headers, dast_site_profile: dast_site_profile) }
let_it_be(:password_variable) { create(:dast_site_profile_secret_variable, :password, dast_site_profile: dast_site_profile) }
......
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