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

Function TestCreateGroup

enterprise/cli/groupcreate_test.go:20–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestCreateGroup(t *testing.T) {
21 t.Parallel()
22
23 t.Run("OK", func(t *testing.T) {
24 t.Parallel()
25
26 client, admin := coderdenttest.New(t, &coderdenttest.Options{LicenseOptions: &coderdenttest.LicenseOptions{
27 Features: license.Features{
28 codersdk.FeatureTemplateRBAC: 1,
29 },
30 }})
31 anotherClient, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID, rbac.RoleUserAdmin())
32
33 var (
34 groupName = "test"
35 avatarURL = "https://example.com"
36 )
37
38 inv, conf := newCLI(t, "groups",
39 "create", groupName,
40 "--avatar-url", avatarURL,
41 )
42
43 pty := ptytest.New(t)
44 inv.Stdout = pty.Output()
45 clitest.SetupConfig(t, anotherClient, conf)
46
47 err := inv.Run()
48 require.NoError(t, err)
49
50 pty.ExpectMatch(fmt.Sprintf("Successfully created group %s!", pretty.Sprint(cliui.DefaultStyles.Keyword, groupName)))
51 })
52}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
CreateAnotherUserFunction · 0.92
RoleUserAdminFunction · 0.92
NewFunction · 0.92
SetupConfigFunction · 0.92
newCLIFunction · 0.85
RunMethod · 0.65
OutputMethod · 0.65
ExpectMatchMethod · 0.45

Tested by

no test coverage detected