MCPcopy Index your code
hub / github.com/apache/casbin / testGetUsers

Function testGetUsers

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

Source from the content-addressed store, hash-verified

40}
41
42func testGetUsers(t *testing.T, e *Enforcer, res []string, name string, domain ...string) {
43 t.Helper()
44 myRes, err := e.GetUsersForRole(name, domain...)
45 switch err {
46 case nil:
47 break
48 case errors.ErrNameNotFound:
49 t.Log("No name found")
50 default:
51 t.Error("Users for ", name, " could not be fetched: ", err.Error())
52 }
53 t.Log("Users for ", name, ": ", myRes)
54
55 if !util.SetEquals(res, myRes) {
56 t.Error("Users for ", name, ": ", myRes, ", supposed to be ", res)
57 }
58}
59
60func testHasRole(t *testing.T, e *Enforcer, name string, role string, res bool, domain ...string) {
61 t.Helper()

Callers 2

TestUserAPIWithDomainsFunction · 0.85

Calls 3

SetEqualsFunction · 0.92
GetUsersForRoleMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…