debian-mirror-gitlab/spec/frontend/token_access/mock_data.js
2023-04-23 21:23:45 +05:30

229 lines
4.4 KiB
JavaScript

export const enabledJobTokenScope = {
data: {
project: {
id: '1',
ciCdSettings: {
jobTokenScopeEnabled: true,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const disabledJobTokenScope = {
data: {
project: {
id: '1',
ciCdSettings: {
jobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
__typename: 'Project',
},
},
};
export const projectsWithScope = {
data: {
project: {
__typename: 'Project',
id: '1',
ciJobTokenScope: {
__typename: 'CiJobTokenScopeType',
projects: {
__typename: 'ProjectConnection',
nodes: [
{
id: '2',
fullPath: 'root/332268-test',
name: 'root/332268-test',
namespace: {
id: '1234',
fullPath: 'root',
},
},
],
},
},
},
},
};
export const addProjectSuccess = {
data: {
ciJobTokenScopeAddProject: {
errors: [],
__typename: 'CiJobTokenScopeAddProjectPayload',
},
},
};
export const removeProjectSuccess = {
data: {
ciJobTokenScopeRemoveProject: {
errors: [],
__typename: 'CiJobTokenScopeRemoveProjectPayload',
},
},
};
export const updateScopeSuccess = {
data: {
ciCdSettingsUpdate: {
ciCdSettings: {
jobTokenScopeEnabled: false,
__typename: 'ProjectCiCdSetting',
},
errors: [],
__typename: 'CiCdSettingsUpdatePayload',
},
},
};
export const mockProjects = [
{
id: '1',
name: 'merge-train-stuff',
namespace: {
id: '1235',
fullPath: 'root',
},
fullPath: 'root/merge-train-stuff',
isLocked: false,
__typename: 'Project',
},
{
id: '2',
name: 'ci-project',
namespace: {
id: '1236',
fullPath: 'root',
},
fullPath: 'root/ci-project',
isLocked: true,
__typename: 'Project',
},
];
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',
},
},
};