2021-12-22 15:14:10 +00:00
|
|
|
export const testProjectPath = 'foo/bar';
|
2022-03-08 15:15:55 +00:00
|
|
|
export const testProviderIds = [101, 102, 103];
|
2022-03-17 18:08:54 +00:00
|
|
|
export const testProviderName = ['Kontra', 'Secure Code Warrior', 'Other Vendor'];
|
2022-03-11 09:07:59 +00:00
|
|
|
export const testTrainingUrls = [
|
|
|
|
'https://www.vendornameone.com/url',
|
|
|
|
'https://www.vendornametwo.com/url',
|
|
|
|
];
|
2021-12-22 15:14:10 +00:00
|
|
|
|
2022-03-08 15:15:55 +00:00
|
|
|
const createSecurityTrainingProviders = ({ providerOverrides = {} }) => [
|
2021-12-10 06:10:22 +00:00
|
|
|
{
|
2022-03-03 21:15:10 +00:00
|
|
|
id: testProviderIds[0],
|
2022-03-10 18:09:14 +00:00
|
|
|
name: testProviderName[0],
|
2022-01-14 12:18:55 +00:00
|
|
|
description: 'Interactive developer security education',
|
|
|
|
url: 'https://www.example.org/security/training',
|
2021-12-10 06:10:22 +00:00
|
|
|
isEnabled: false,
|
2022-02-16 18:14:47 +00:00
|
|
|
isPrimary: false,
|
2022-03-08 15:15:55 +00:00
|
|
|
...providerOverrides.first,
|
2021-12-10 06:10:22 +00:00
|
|
|
},
|
|
|
|
{
|
2022-03-03 21:15:10 +00:00
|
|
|
id: testProviderIds[1],
|
2022-03-10 18:09:14 +00:00
|
|
|
name: testProviderName[1],
|
2021-12-10 06:10:22 +00:00
|
|
|
description: 'Security training with guide and learning pathways.',
|
2022-01-14 12:18:55 +00:00
|
|
|
url: 'https://www.vendornametwo.com/',
|
2022-03-08 15:15:55 +00:00
|
|
|
isEnabled: false,
|
|
|
|
isPrimary: false,
|
|
|
|
...providerOverrides.second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: testProviderIds[2],
|
2022-03-10 18:09:14 +00:00
|
|
|
name: testProviderName[2],
|
2022-03-08 15:15:55 +00:00
|
|
|
description: 'Security training for the everyday developer.',
|
|
|
|
url: 'https://www.vendornamethree.com/',
|
|
|
|
isEnabled: false,
|
2022-02-16 18:14:47 +00:00
|
|
|
isPrimary: false,
|
2022-03-08 15:15:55 +00:00
|
|
|
...providerOverrides.third,
|
2021-12-10 06:10:22 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-03-08 15:15:55 +00:00
|
|
|
export const getSecurityTrainingProvidersData = (providerOverrides = {}) => {
|
|
|
|
const securityTrainingProviders = createSecurityTrainingProviders(providerOverrides);
|
|
|
|
const response = {
|
|
|
|
data: {
|
|
|
|
project: {
|
2022-03-15 03:08:45 +00:00
|
|
|
id: 'gid://gitlab/Project/1',
|
|
|
|
__typename: 'Project',
|
2022-03-08 15:15:55 +00:00
|
|
|
securityTrainingProviders,
|
|
|
|
},
|
2021-12-16 12:15:41 +00:00
|
|
|
},
|
2022-03-08 15:15:55 +00:00
|
|
|
};
|
2022-02-04 06:15:28 +00:00
|
|
|
|
2022-03-08 15:15:55 +00:00
|
|
|
return {
|
|
|
|
response,
|
|
|
|
data: securityTrainingProviders,
|
|
|
|
};
|
2022-02-23 18:16:59 +00:00
|
|
|
};
|
|
|
|
|
2022-02-04 06:15:28 +00:00
|
|
|
export const dismissUserCalloutResponse = {
|
|
|
|
data: {
|
|
|
|
userCalloutCreate: {
|
|
|
|
errors: [],
|
|
|
|
userCallout: {
|
|
|
|
dismissedAt: '2022-02-02T04:36:57Z',
|
|
|
|
featureName: 'SECURITY_TRAINING_FEATURE_PROMOTION',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const dismissUserCalloutErrorResponse = {
|
|
|
|
data: {
|
|
|
|
userCalloutCreate: {
|
|
|
|
errors: ['Something went wrong'],
|
|
|
|
userCallout: {
|
|
|
|
dismissedAt: '',
|
|
|
|
featureName: 'SECURITY_TRAINING_FEATURE_PROMOTION',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-02-16 18:14:47 +00:00
|
|
|
|
|
|
|
export const updateSecurityTrainingProvidersResponse = {
|
|
|
|
data: {
|
|
|
|
securityTrainingUpdate: {
|
|
|
|
errors: [],
|
|
|
|
training: {
|
|
|
|
id: 101,
|
|
|
|
name: 'Acme',
|
|
|
|
isEnabled: true,
|
|
|
|
isPrimary: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const updateSecurityTrainingProvidersErrorResponse = {
|
|
|
|
data: {
|
|
|
|
securityTrainingUpdate: {
|
|
|
|
errors: ['something went wrong!'],
|
|
|
|
training: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-03-09 18:08:16 +00:00
|
|
|
|
|
|
|
// Will remove once this issue is resolved where the svg path will be available in the GraphQL query
|
|
|
|
// https://gitlab.com/gitlab-org/gitlab/-/issues/346899
|
|
|
|
export const tempProviderLogos = {
|
2022-03-10 18:09:14 +00:00
|
|
|
[testProviderName[0]]: {
|
2022-03-15 21:07:57 +00:00
|
|
|
svg: `<svg>${[testProviderName[0]]}</svg>`,
|
2022-03-09 18:08:16 +00:00
|
|
|
},
|
2022-03-10 18:09:14 +00:00
|
|
|
[testProviderName[1]]: {
|
2022-03-15 21:07:57 +00:00
|
|
|
svg: `<svg>${[testProviderName[1]]}</svg>`,
|
2022-03-09 18:08:16 +00:00
|
|
|
},
|
|
|
|
};
|
2022-04-29 21:10:44 +00:00
|
|
|
|
|
|
|
export const getCurrentLicensePlanResponse = (plan) => ({
|
|
|
|
data: {
|
|
|
|
currentLicense: {
|
|
|
|
id: 'gid://gitlab/License/1',
|
|
|
|
plan,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|