20829: Add canWrite and canManage to group and API response dialog
[arvados-workbench2.git] / src / models / test-utils.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { GroupClass, GroupResource } from "./group";
6 import { Resource, ResourceKind } from "./resource";
7 import { ProjectResource } from "./project";
8
9 export const mockGroupResource = (data: Partial<GroupResource> = {}): GroupResource => ({
10     createdAt: "",
11     deleteAt: "",
12     description: "",
13     etag: "",
14     groupClass: null,
15     href: "",
16     isTrashed: false,
17     kind: ResourceKind.GROUP,
18     modifiedAt: "",
19     modifiedByClientUuid: "",
20     modifiedByUserUuid: "",
21     name: "",
22     ownerUuid: "",
23     properties: "",
24     trashAt: "",
25     uuid: "",
26     writableBy: [],
27     ensure_unique_name: true,
28     canWrite: false,
29     canManage: false,
30     ...data
31 });
32
33 export const mockProjectResource = (data: Partial<ProjectResource> = {}): ProjectResource =>
34     mockGroupResource({ ...data, groupClass: GroupClass.PROJECT }) as ProjectResource;
35
36 export const mockCommonResource = (data: Partial<Resource>): Resource => ({
37     createdAt: "",
38     etag: "",
39     href: "",
40     kind: ResourceKind.NONE,
41     modifiedAt: "",
42     modifiedByClientUuid: "",
43     modifiedByUserUuid: "",
44     ownerUuid: "",
45     uuid: "",
46     ...data
47 });