feat: Implement list roles & enforce authorize examples (#1273)

This commit is contained in:
Steven Masley
2022-05-03 16:10:19 -05:00
committed by GitHub
parent 0f9e30e54f
commit d0293e4d33
13 changed files with 627 additions and 5 deletions

View File

@ -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))
}