MCPcopy
hub / github.com/apache/casbin / testGetRoles

Function testGetRoles

rbac_api_test.go:29–40  ·  view source on GitHub ↗
(t *testing.T, e *Enforcer, res []string, name string, domain ...string)

Source from the content-addressed store, hash-verified

27)
28
29func testGetRoles(t *testing.T, e *Enforcer, res []string, name string, domain ...string) {
30 t.Helper()
31 myRes, err := e.GetRolesForUser(name, domain...)
32 if err != nil {
33 t.Error("Roles for ", name, " could not be fetched: ", err.Error())
34 }
35 t.Log("Roles for ", name, ": ", myRes)
36
37 if !util.SetEquals(res, myRes) {
38 t.Error("Roles for ", name, ": ", myRes, ", supposed to be ", res)
39 }
40}
41
42func testGetUsers(t *testing.T, e *Enforcer, res []string, name string, domain ...string) {
43 t.Helper()

Callers 6

TestRoleAPIWithDomainsFunction · 0.85
TestRoleAPIFunction · 0.85
TestRoleAPI_DomainsFunction · 0.85
TestImplicitRoleAPIFunction · 0.85

Calls 3

SetEqualsFunction · 0.92
GetRolesForUserMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…