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

230 lines
4.4 KiB
JavaScript
Raw Normal View History

2021-09-30 23:02:18 +05:30
export const enabledJobTokenScope = {
data: {
project: {
2022-01-26 12:08:38 +05:30
id: '1',
2021-09-30 23:02:18 +05:30
ciCdSettings: {
jobTokenScopeEnabled: true,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const disabledJobTokenScope = {
data: {
project: {
2022-01-26 12:08:38 +05:30
id: '1',
2021-09-30 23:02:18 +05:30
ciCdSettings: {
jobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const projectsWithScope = {
data: {
project: {
__typename: 'Project',
2022-01-26 12:08:38 +05:30
id: '1',
2021-09-30 23:02:18 +05:30
ciJobTokenScope: {
__typename: 'CiJobTokenScopeType',
projects: {
__typename: 'ProjectConnection',
nodes: [
{
2022-01-26 12:08:38 +05:30
id: '2',
2021-09-30 23:02:18 +05:30
fullPath: 'root/332268-test',
name: 'root/332268-test',
2023-01-13 00:05:48 +05:30
namespace: {
id: '1234',
fullPath: 'root',
},
2021-09-30 23:02:18 +05:30
},
],
},
},
},
},
};
export const addProjectSuccess = {
data: {
ciJobTokenScopeAddProject: {
errors: [],
__typename: 'CiJobTokenScopeAddProjectPayload',
},
},
};
export const removeProjectSuccess = {
data: {
ciJobTokenScopeRemoveProject: {
errors: [],
__typename: 'CiJobTokenScopeRemoveProjectPayload',
},
},
};
2023-03-04 22:38:38 +05:30
export const updateScopeSuccess = {
data: {
ciCdSettingsUpdate: {
ciCdSettings: {
jobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
errors: [],
__typename: 'CiCdSettingsUpdatePayload',
},
},
};
2021-09-30 23:02:18 +05:30
export const mockProjects = [
{
2022-01-26 12:08:38 +05:30
id: '1',
2021-09-30 23:02:18 +05:30
name: 'merge-train-stuff',
2023-01-13 00:05:48 +05:30
namespace: {
id: '1235',
fullPath: 'root',
},
2021-09-30 23:02:18 +05:30
fullPath: 'root/merge-train-stuff',
isLocked: false,
__typename: 'Project',
},
2022-01-26 12:08:38 +05:30
{
id: '2',
name: 'ci-project',
2023-01-13 00:05:48 +05:30
namespace: {
id: '1236',
fullPath: 'root',
},
2022-01-26 12:08:38 +05:30
fullPath: 'root/ci-project',
isLocked: true,
__typename: 'Project',
},
2021-09-30 23:02:18 +05:30
];
2023-04-23 21:23:45 +05:30
export const mockFields = [
{
key: 'project',
label: 'Project with access',
},
{
key: 'namespace',
label: 'Namespace',
},
{
key: 'actions',
label: '',
},
];
export const optInJwtQueryResponse = (optInJwt) => ({
data: {
project: {
id: '1',
ciCdSettings: {
optInJwt,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
});
export const optInJwtMutationResponse = (optInJwt) => ({
data: {
ciCdSettingsUpdate: {
ciCdSettings: {
optInJwt,
__typename: 'ProjectCiCdSetting',
},
errors: [],
__typename: 'CiCdSettingsUpdatePayload',
},
},
});
export const inboundJobTokenScopeEnabledResponse = {
data: {
project: {
id: '1',
ciCdSettings: {
inboundJobTokenScopeEnabled: true,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const inboundJobTokenScopeDisabledResponse = {
data: {
project: {
id: '1',
ciCdSettings: {
inboundJobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const inboundProjectsWithScopeResponse = {
data: {
project: {
__typename: 'Project',
id: '1',
ciJobTokenScope: {
__typename: 'CiJobTokenScopeType',
inboundAllowlist: {
__typename: 'ProjectConnection',
nodes: [
{
__typename: 'Project',
fullPath: 'root/ci-project',
id: 'gid://gitlab/Project/23',
name: 'ci-project',
namespace: { id: 'gid://gitlab/Namespaces::UserNamespace/1', fullPath: 'root' },
},
],
},
},
},
},
};
export const inboundAddProjectSuccessResponse = {
data: {
ciJobTokenScopeAddProject: {
errors: [],
__typename: 'CiJobTokenScopeAddProjectPayload',
},
},
};
export const inboundRemoveProjectSuccess = {
data: {
ciJobTokenScopeRemoveProject: {
errors: [],
__typename: 'CiJobTokenScopeRemoveProjectPayload',
},
},
};
export const inboundUpdateScopeSuccessResponse = {
data: {
ciCdSettingsUpdate: {
ciCdSettings: {
inboundJobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
errors: [],
__typename: 'CiCdSettingsUpdatePayload',
},
},
};