MCPcopy Index your code
hub / github.com/coder/coder / CreateGroup

Function CreateGroup

coderd/coderdtest/coderdtest.go:1123–1139  ·  view source on GitHub ↗

CreateGroup creates a group with the given name and members.

(t testing.TB, client *codersdk.Client, organizationID uuid.UUID, name string, members ...codersdk.User)

Source from the content-addressed store, hash-verified

1121
1122// CreateGroup creates a group with the given name and members.
1123func CreateGroup(t testing.TB, client *codersdk.Client, organizationID uuid.UUID, name string, members ...codersdk.User) codersdk.Group {
1124 t.Helper()
1125 group, err := client.CreateGroup(context.Background(), organizationID, codersdk.CreateGroupRequest{
1126 Name: name,
1127 })
1128 require.NoError(t, err, "failed to create group")
1129 memberIDs := make([]string, 0)
1130 for _, member := range members {
1131 memberIDs = append(memberIDs, member.ID.String())
1132 }
1133 group, err = client.PatchGroup(context.Background(), group.ID, codersdk.PatchGroupRequest{
1134 AddUsers: memberIDs,
1135 })
1136
1137 require.NoError(t, err, "failed to add members to group")
1138 return group
1139}
1140
1141// UpdateTemplateVersion creates a new template version with the "echo" provisioner
1142// and associates it with the given templateID.

Callers 12

TestUpdateWorkspaceACLFunction · 0.92
TestWorkspaceBuildFunction · 0.92
TestTemplateACLFunction · 0.92
TestUpdateTemplateACLFunction · 0.92
TestGroupDeleteFunction · 0.92
TestGroupEditFunction · 0.92
TestStartFunction · 0.92
TestGroupListFunction · 0.92

Calls 4

CreateGroupMethod · 0.80
PatchGroupMethod · 0.80
HelperMethod · 0.65
StringMethod · 0.45

Tested by 12

TestUpdateWorkspaceACLFunction · 0.74
TestWorkspaceBuildFunction · 0.74
TestTemplateACLFunction · 0.74
TestUpdateTemplateACLFunction · 0.74
TestGroupDeleteFunction · 0.74
TestGroupEditFunction · 0.74
TestStartFunction · 0.74
TestGroupListFunction · 0.74