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

Function TestInitialRoles

coderd/users_test.go:1643–1656  ·  view source on GitHub ↗

TestInitialRoles ensures the starting roles for the first user are correct.

(t *testing.T)

Source from the content-addressed store, hash-verified

1641
1642// TestInitialRoles ensures the starting roles for the first user are correct.
1643func TestInitialRoles(t *testing.T) {
1644 t.Parallel()
1645 ctx := context.Background()
1646 client := coderdtest.New(t, nil)
1647 first := coderdtest.CreateFirstUser(t, client)
1648
1649 roles, err := client.UserRoles(ctx, codersdk.Me)
1650 require.NoError(t, err)
1651 require.ElementsMatch(t, roles.Roles, []string{
1652 codersdk.RoleOwner,
1653 }, "should be a member and admin")
1654
1655 require.ElementsMatch(t, roles.OrganizationRoles[first.OrganizationID], []string{}, "should be a member")
1656}
1657
1658func TestPutUserSuspend(t *testing.T) {
1659 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
CreateFirstUserFunction · 0.92
UserRolesMethod · 0.80

Tested by

no test coverage detected