2021-12-22 10:14:10 -05:00
|
|
|
export const testProjectPath = 'foo/bar';
|
2022-03-08 10:15:55 -05:00
|
|
|
export const testProviderIds = [101, 102, 103];
|
2022-03-10 13:09:14 -05:00
|
|
|
export const testProviderName = ['Vendor Name 1', 'Vendor Name 2', 'Vendor Name 3'];
|
2022-03-11 04:07:59 -05:00
|
|
|
export const testTrainingUrls = [
|
|
|
|
'https://www.vendornameone.com/url',
|
|
|
|
'https://www.vendornametwo.com/url',
|
|
|
|
];
|
2021-12-22 10:14:10 -05:00
|
|
|
|
2022-03-08 10:15:55 -05:00
|
|
|
const createSecurityTrainingProviders = ({ providerOverrides = {} }) => [
|
2021-12-10 01:10:22 -05:00
|
|
|
{
|
2022-03-03 16:15:10 -05:00
|
|
|
id: testProviderIds[0],
|
2022-03-10 13:09:14 -05:00
|
|
|
name: testProviderName[0],
|
2022-01-14 07:18:55 -05:00
|
|
|
description: 'Interactive developer security education',
|
|
|
|
url: 'https://www.example.org/security/training',
|
2021-12-10 01:10:22 -05:00
|
|
|
isEnabled: false,
|
2022-02-16 13:14:47 -05:00
|
|
|
isPrimary: false,
|
2022-03-08 10:15:55 -05:00
|
|
|
...providerOverrides.first,
|
2021-12-10 01:10:22 -05:00
|
|
|
},
|
|
|
|
{
|
2022-03-03 16:15:10 -05:00
|
|
|
id: testProviderIds[1],
|
2022-03-10 13:09:14 -05:00
|
|
|
name: testProviderName[1],
|
2021-12-10 01:10:22 -05:00
|
|
|
description: 'Security training with guide and learning pathways.',
|
2022-01-14 07:18:55 -05:00
|
|
|
url: 'https://www.vendornametwo.com/',
|
2022-03-08 10:15:55 -05:00
|
|
|
isEnabled: false,
|
|
|
|
isPrimary: false,
|
|
|
|
...providerOverrides.second,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: testProviderIds[2],
|
2022-03-10 13:09:14 -05:00
|
|
|
name: testProviderName[2],
|
2022-03-08 10:15:55 -05:00
|
|
|
description: 'Security training for the everyday developer.',
|
|
|
|
url: 'https://www.vendornamethree.com/',
|
|
|
|
isEnabled: false,
|
2022-02-16 13:14:47 -05:00
|
|
|
isPrimary: false,
|
2022-03-08 10:15:55 -05:00
|
|
|
...providerOverrides.third,
|
2021-12-10 01:10:22 -05:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-03-08 10:15:55 -05:00
|
|
|
export const getSecurityTrainingProvidersData = (providerOverrides = {}) => {
|
|
|
|
const securityTrainingProviders = createSecurityTrainingProviders(providerOverrides);
|
|
|
|
const response = {
|
|
|
|
data: {
|
|
|
|
project: {
|
2022-03-14 23:08:45 -04:00
|
|
|
id: 'gid://gitlab/Project/1',
|
|
|
|
__typename: 'Project',
|
2022-03-08 10:15:55 -05:00
|
|
|
securityTrainingProviders,
|
|
|
|
},
|
2021-12-16 07:15:41 -05:00
|
|
|
},
|
2022-03-08 10:15:55 -05:00
|
|
|
};
|
2022-02-04 01:15:28 -05:00
|
|
|
|
2022-03-08 10:15:55 -05:00
|
|
|
return {
|
|
|
|
response,
|
|
|
|
data: securityTrainingProviders,
|
|
|
|
};
|
2022-02-23 13:16:59 -05:00
|
|
|
};
|
|
|
|
|
2022-02-04 01:15:28 -05: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 13:14:47 -05: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 13:08:16 -05: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 13:09:14 -05:00
|
|
|
[testProviderName[0]]: {
|
2022-03-09 13:08:16 -05:00
|
|
|
svg: '/assets/illustrations/vulnerability/vendor-1.svg',
|
|
|
|
},
|
2022-03-10 13:09:14 -05:00
|
|
|
[testProviderName[1]]: {
|
2022-03-09 13:08:16 -05:00
|
|
|
svg: '/assets/illustrations/vulnerability/vendor-2.svg',
|
|
|
|
},
|
|
|
|
};
|