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

Function testGetPermissions

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

Source from the content-addressed store, hash-verified

192}
193
194func testGetPermissions(t *testing.T, e *Enforcer, name string, res [][]string, domain ...string) {
195 t.Helper()
196 myRes, err := e.GetPermissionsForUser(name, domain...)
197 if err != nil {
198 t.Error(err.Error())
199 }
200 t.Log("Permissions for ", name, ": ", myRes)
201
202 if !util.Array2DEquals(res, myRes) {
203 t.Error("Permissions for ", name, ": ", myRes, ", supposed to be ", res)
204 }
205}
206
207func testHasPermission(t *testing.T, e *Enforcer, name string, permission []string, res bool) {
208 t.Helper()

Callers 4

TestRoleAPI_DomainsFunction · 0.85
TestPermissionAPIFunction · 0.85
TestImplicitRoleAPIFunction · 0.85

Calls 3

Array2DEqualsFunction · 0.92
GetPermissionsForUserMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…