debian-mirror-gitlab/spec/frontend/security_configuration/mock_data.js

103 lines
2.4 KiB
JavaScript
Raw Normal View History

2022-03-02 08:16:31 +05:30
export const testProjectPath = 'foo/bar';
2022-05-07 20:08:51 +05:30
export const testProviderIds = [101, 102, 103];
export const testProviderName = ['Kontra', 'Secure Code Warrior', 'Other Vendor'];
export const testTrainingUrls = [
'https://www.vendornameone.com/url',
'https://www.vendornametwo.com/url',
];
2022-03-02 08:16:31 +05:30
2022-05-07 20:08:51 +05:30
const createSecurityTrainingProviders = ({ providerOverrides = {} }) => [
2022-01-26 12:08:38 +05:30
{
2022-05-07 20:08:51 +05:30
id: testProviderIds[0],
name: testProviderName[0],
2022-03-02 08:16:31 +05:30
description: 'Interactive developer security education',
url: 'https://www.example.org/security/training',
2022-01-26 12:08:38 +05:30
isEnabled: false,
2022-04-04 11:22:00 +05:30
isPrimary: false,
2022-05-07 20:08:51 +05:30
...providerOverrides.first,
2022-01-26 12:08:38 +05:30
},
{
2022-05-07 20:08:51 +05:30
id: testProviderIds[1],
name: testProviderName[1],
2022-01-26 12:08:38 +05:30
description: 'Security training with guide and learning pathways.',
2022-03-02 08:16:31 +05:30
url: 'https://www.vendornametwo.com/',
2022-05-07 20:08:51 +05:30
isEnabled: false,
isPrimary: false,
...providerOverrides.second,
},
{
id: testProviderIds[2],
name: testProviderName[2],
description: 'Security training for the everyday developer.',
url: 'https://www.vendornamethree.com/',
isEnabled: false,
2022-04-04 11:22:00 +05:30
isPrimary: false,
2022-05-07 20:08:51 +05:30
...providerOverrides.third,
2022-01-26 12:08:38 +05:30
},
];
2022-05-07 20:08:51 +05:30
export const getSecurityTrainingProvidersData = (providerOverrides = {}) => {
const securityTrainingProviders = createSecurityTrainingProviders(providerOverrides);
const response = {
data: {
project: {
id: 'gid://gitlab/Project/1',
__typename: 'Project',
securityTrainingProviders,
},
2022-04-04 11:22:00 +05:30
},
2022-05-07 20:08:51 +05:30
};
return {
response,
data: securityTrainingProviders,
};
2022-04-04 11:22:00 +05:30
};
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-01-26 12:08:38 +05:30
},
};
2022-04-04 11:22:00 +05:30
export const updateSecurityTrainingProvidersResponse = {
data: {
securityTrainingUpdate: {
errors: [],
training: {
id: 101,
name: 'Acme',
isEnabled: true,
isPrimary: false,
},
2022-01-26 12:08:38 +05:30
},
},
};
2022-03-02 08:16:31 +05:30
2022-04-04 11:22:00 +05:30
export const updateSecurityTrainingProvidersErrorResponse = {
data: {
securityTrainingUpdate: {
errors: ['something went wrong!'],
training: null,
},
},
};