Generate DAST profiles mocks

parent f6ecd022
......@@ -321,5 +321,33 @@ RSpec.describe 'DAST profiles (GraphQL fixtures)' do
expect(graphql_data_at(:project, :pipelines, :nodes)).to have_attributes(size: 1)
end
end
describe 'dast_profiles' do
path = 'security_configuration/dast_profiles/graphql/dast_profiles.query.graphql'
let_it_be(:dast_profiles) do
[
create(:dast_profile, project: project),
create(:dast_profile, project: project)
]
end
before do
dast_profiles.first.branch_name = SecureRandom.hex
dast_profiles.first.save!(validate: false)
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,
first: 20
})
expect_graphql_errors_to_be_empty
expect(graphql_data_at(:project, :dastProfiles, :edges)).to have_attributes(size: dast_profiles.length)
end
end
end
end
import siteProfilesFixture from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql.basic.json';
import scannerProfilesFixtures from 'test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql.basic.json';
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';
......@@ -14,38 +15,19 @@ export const validatedSiteProfile = siteProfiles.find(
({ validationStatus }) => validationStatus === 'PASSED_VALIDATION',
);
export const policySiteProfiles = policySiteProfilesFixtures.data.project.siteProfiles.edges.map(({node}) => node)
export const policySiteProfiles = policySiteProfilesFixtures.data.project.siteProfiles.edges.map(
({ node }) => node,
);
export const policyScannerProfiles = policyScannerProfilesFixtures.data.project.scannerProfiles.edges.map(({node}) => node)
export const policyScannerProfiles = policyScannerProfilesFixtures.data.project.scannerProfiles.edges.map(
({ node }) => node,
);
export const scannerProfiles = scannerProfilesFixtures.data.project.scannerProfiles.edges.map(
({ node }) => node,
);
export const savedScans = [
{
id: 'gid://gitlab/DastProfile/1',
name: 'Scan 1',
dastSiteProfile: siteProfiles[0],
dastScannerProfile: scannerProfiles[0],
editPath: '/1/edit',
branch: {
name: 'main',
exists: true,
},
},
{
id: 'gid://gitlab/DastProfile/2',
name: 'Scan 2',
dastSiteProfile: siteProfiles[1],
dastScannerProfile: scannerProfiles[1],
editPath: '/2/edit',
branch: {
name: 'feature-branch',
exists: false,
},
},
];
export const savedScans = profilesFixtures.data.project.dastProfiles.edges.map(({ node }) => node);
export const failedSiteValidations = [
{
......
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