Generate DAST failed site validations mocks

parent 000fdbe6
......@@ -349,5 +349,45 @@ RSpec.describe 'DAST profiles (GraphQL fixtures)' do
expect(graphql_data_at(:project, :dastProfiles, :edges)).to have_attributes(size: dast_profiles.length)
end
end
describe 'dast_site_validations' do
context 'failed site validations' do
path = 'security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql'
let_it_be(:dast_site_validation_https) do
create(
:dast_site_validation,
state: :failed,
dast_site_token: create(
:dast_site_token,
url: 'https://example.com',
project: project
)
)
end
let_it_be(:dast_site_validation_http) do
create(
:dast_site_validation,
state: :failed,
dast_site_token: create(
:dast_site_token,
url: 'http://example.com',
project: project
)
)
end
it "graphql/#{path}.json" do
query = get_graphql_query_as_string(path, ee: true)
post_graphql(query, current_user: current_user, variables: {
fullPath: project.full_path
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :validations, :nodes)).to have_attributes(size: 2)
end
end
end
end
end
......@@ -3,6 +3,7 @@ import scannerProfilesFixtures from 'test_fixtures/graphql/security_configuratio
import profilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_profiles.query.graphql.json';
import policySiteProfilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql.from_policies.json';
import policyScannerProfilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql.from_policies.json';
import dastFailedSiteValidationsFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_failed_site_validations.query.graphql.json';
export const siteProfiles = siteProfilesFixture.data.project.siteProfiles.edges.map(
({ node }) => node,
......@@ -29,13 +30,4 @@ export const scannerProfiles = scannerProfilesFixtures.data.project.scannerProfi
export const savedScans = profilesFixtures.data.project.dastProfiles.edges.map(({ node }) => node);
export const failedSiteValidations = [
{
id: '1',
normalizedTargetUrl: 'http://example.com:80',
},
{
id: '2',
normalizedTargetUrl: 'https://example.com:443',
},
];
export const failedSiteValidations = dastFailedSiteValidationsFixtures.data.project.validations.nodes;
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