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

Function testSyncedEnforcerGetUsers

enforcer_synced_test.go:474–494  ·  view source on GitHub ↗
(t *testing.T, e *SyncedEnforcer, res []string, name string, domain ...string)

Source from the content-addressed store, hash-verified

472}
473
474func testSyncedEnforcerGetUsers(t *testing.T, e *SyncedEnforcer, res []string, name string, domain ...string) {
475 t.Helper()
476 myRes, err := e.GetUsersForRole(name, domain...)
477 myResCopy := make([]string, len(myRes))
478 copy(myResCopy, myRes)
479 sort.Strings(myRes)
480 sort.Strings(res)
481 switch err {
482 case nil:
483 break
484 case errors.ErrNameNotFound:
485 t.Log("No name found")
486 default:
487 t.Error("Users for ", name, " could not be fetched: ", err.Error())
488 }
489 t.Log("Users for ", name, ": ", myRes)
490
491 if !util.SetEquals(res, myRes) {
492 t.Error("Users for ", name, ": ", myRes, ", supposed to be ", res)
493 }
494}
495func TestSyncedEnforcerAddGroupingPoliciesEx(t *testing.T) {
496 for i := 0; i < 10; i++ {
497 e, _ := NewSyncedEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")

Calls 4

SetEqualsFunction · 0.92
GetUsersForRoleMethod · 0.65
StringsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…