Fix client-side mutation for updating DAST site profiles

- Updated the client-side mutation's schema to match the backend
implementation
- Use global ID instead of plain ID
- Added specs
parent fd46e8ce
mutation dastSiteProfileUpdate(
$id: ID!
$id: DastSiteProfileID!
$fullPath: ID!
$profileName: String!
$targetUrl: String
) {
project(fullPath: $fullPath) {
dastSiteProfileUpdate(input: { id: $id, profileName: $profileName, targetUrl: $targetUrl }) {
id
errors
}
dastSiteProfileUpdate(
input: { id: $id, fullPath: $fullPath, profileName: $profileName, targetUrl: $targetUrl }
) {
id
errors
}
}
......@@ -12,6 +12,7 @@ module Projects
.dast_site_profiles
.with_dast_site
.find(params[:id])
@site_profile_gid = @site_profile.to_global_id
end
private
......
......@@ -5,4 +5,4 @@
.js-dast-site-profile-form{ data: { full_path: @project.path_with_namespace,
profiles_library_path: project_profiles_path(@project),
site_profile: { id: @site_profile.id, name: @site_profile.name, target_url: @site_profile.dast_site.url }.to_json } }
site_profile: { id: @site_profile_gid.to_s, name: @site_profile.name, target_url: @site_profile.dast_site.url }.to_json } }
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "projects/dast_site_profiles/edit", type: :view do
before do
@project = create(:project)
@site_profile = create(:dast_site_profile)
@site_profile_gid = ::URI::GID.parse("gid://gitlab/DastSiteProfile/#{@site_profile.id}")
render
end
it 'renders Vue app root' do
expect(rendered).to have_selector('.js-dast-site-profile-form')
end
it 'passes project\'s full path' do
expect(rendered).to include @project.path_with_namespace
end
it 'passes DAST profiles library URL' do
expect(rendered).to include '/on_demand_scans/profiles'
end
it 'passes DAST site profile\'s data' do
expect(rendered).to include @site_profile_gid.to_s
expect(rendered).to include @site_profile.name
expect(rendered).to include @site_profile.dast_site.url
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