Skip to content

Commit 0efe72c

Browse files
committed
Add unit test
1 parent 42b42ab commit 0efe72c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

coderd/rbac/builtin_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package rbac_test
22

33
import (
4+
"fmt"
45
"testing"
56

67
"github.com/google/uuid"
@@ -60,3 +61,23 @@ func TestIsOrgRole(t *testing.T) {
6061
})
6162
}
6263
}
64+
65+
func TestListRoles(t *testing.T) {
66+
t.Parallel()
67+
68+
// If this test is ever failing, just update the list to the roles
69+
// expected from the builtin set.
70+
require.ElementsMatch(t, []string{
71+
"admin",
72+
"member",
73+
"auditor",
74+
},
75+
rbac.SiteRoles())
76+
77+
orgID := uuid.New()
78+
require.ElementsMatch(t, []string{
79+
fmt.Sprintf("organization-admin:%s", orgID.String()),
80+
fmt.Sprintf("organization-member:%s", orgID.String()),
81+
},
82+
rbac.OrganizationRoles(orgID))
83+
}

0 commit comments

Comments
 (0)