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

Function testGetNamedPermissionsForUser

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

Source from the content-addressed store, hash-verified

219}
220
221func testGetNamedPermissionsForUser(t *testing.T, e *Enforcer, ptype string, name string, res [][]string, domain ...string) {
222 t.Helper()
223 myRes, err := e.GetNamedPermissionsForUser(ptype, name, domain...)
224 if err != nil {
225 t.Error(err.Error())
226 }
227 t.Log("Named permissions for ", name, ": ", myRes)
228
229 if !util.Array2DEquals(res, myRes) {
230 t.Error("Named permissions for ", name, ": ", myRes, ", supposed to be ", res)
231 }
232}
233
234func TestPermissionAPI(t *testing.T) {
235 e, _ := NewEnforcer("examples/basic_without_resources_model.conf", "examples/basic_without_resources_policy.csv")

Callers 1

TestPermissionAPIFunction · 0.85

Calls 3

Array2DEqualsFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…