mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: Implement list roles & enforce authorize examples (#1273)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package rbac_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@ -60,3 +61,23 @@ func TestIsOrgRole(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestListRoles(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// If this test is ever failing, just update the list to the roles
|
||||
// expected from the builtin set.
|
||||
require.ElementsMatch(t, []string{
|
||||
"admin",
|
||||
"member",
|
||||
"auditor",
|
||||
},
|
||||
rbac.SiteRoles())
|
||||
|
||||
orgID := uuid.New()
|
||||
require.ElementsMatch(t, []string{
|
||||
fmt.Sprintf("organization-admin:%s", orgID.String()),
|
||||
fmt.Sprintf("organization-member:%s", orgID.String()),
|
||||
},
|
||||
rbac.OrganizationRoles(orgID))
|
||||
}
|
||||
|
Reference in New Issue
Block a user