MCPcopy Create free account
hub / github.com/coder/coder / TestExpandCustomRoleRoles

Function TestExpandCustomRoleRoles

coderd/rbac/rolestore/rolestore_test.go:19–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestExpandCustomRoleRoles(t *testing.T) {
20 t.Parallel()
21
22 db, _ := dbtestutil.NewDB(t)
23
24 org := dbgen.Organization(t, db, database.Organization{})
25
26 const roleName = "test-role"
27 dbgen.CustomRole(t, db, database.CustomRole{
28 Name: roleName,
29 DisplayName: "",
30 SitePermissions: nil,
31 OrgPermissions: nil,
32 UserPermissions: nil,
33 OrganizationID: uuid.NullUUID{
34 UUID: org.ID,
35 Valid: true,
36 },
37 })
38
39 ctx := testutil.Context(t, testutil.WaitShort)
40 roles, err := rolestore.Expand(ctx, db, []rbac.RoleIdentifier{{Name: roleName, OrganizationID: org.ID}})
41 require.NoError(t, err)
42 require.Len(t, roles, 1, "role found")
43}
44
45func TestReconcileSystemRole(t *testing.T) {
46 t.Parallel()

Callers

nothing calls this directly

Calls 6

NewDBFunction · 0.92
OrganizationFunction · 0.92
CustomRoleFunction · 0.92
ContextFunction · 0.92
ExpandFunction · 0.92
LenMethod · 0.45

Tested by

no test coverage detected