(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func TestGroupDelete(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 | group := coderdtest.CreateGroup(t, client, admin.OrganizationID, "alpha") |
| 34 | |
| 35 | inv, conf := newCLI(t, |
| 36 | "groups", "delete", group.Name, |
| 37 | ) |
| 38 | |
| 39 | pty := ptytest.New(t) |
| 40 | |
| 41 | inv.Stdout = pty.Output() |
| 42 | clitest.SetupConfig(t, anotherClient, conf) |
| 43 | |
| 44 | err := inv.Run() |
| 45 | require.NoError(t, err) |
| 46 | |
| 47 | pty.ExpectMatch(fmt.Sprintf("Successfully deleted group %s", pretty.Sprint(cliui.DefaultStyles.Keyword, group.Name))) |
| 48 | }) |
| 49 | |
| 50 | t.Run("NoArg", func(t *testing.T) { |
| 51 | t.Parallel() |
| 52 | |
| 53 | client, admin := coderdenttest.New(t, &coderdenttest.Options{LicenseOptions: &coderdenttest.LicenseOptions{ |
| 54 | Features: license.Features{ |
| 55 | codersdk.FeatureTemplateRBAC: 1, |
| 56 | }, |
| 57 | }}) |
| 58 | anotherClient, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID, rbac.RoleUserAdmin()) |
| 59 | |
| 60 | inv, conf := newCLI( |
| 61 | t, |
| 62 | "groups", "delete", |
| 63 | ) |
| 64 | |
| 65 | clitest.SetupConfig(t, anotherClient, conf) |
| 66 | |
| 67 | err := inv.Run() |
| 68 | require.Error(t, err) |
| 69 | }) |
| 70 | } |
nothing calls this directly
no test coverage detected