MCPcopy Create free account
hub / github.com/apache/casbin / TestReloadPolicyWithFunc

Function TestReloadPolicyWithFunc

enforcer_test.go:609–617  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

607}
608
609func TestReloadPolicyWithFunc(t *testing.T) {
610 e, _ := NewEnforcer("examples/rbac_with_pattern_model.conf", "examples/rbac_with_pattern_policy.csv")
611 e.AddNamedMatchingFunc("g2", "matchingFunc", util.KeyMatch2)
612 testEnforce(t, e, "alice", "/book/1", "GET", true)
613 testEnforce(t, e, "bob", "/pen/3", "GET", true)
614 _ = e.LoadPolicy()
615 testEnforce(t, e, "alice", "/book/1", "GET", true)
616 testEnforce(t, e, "bob", "/pen/3", "GET", true)
617}
618
619func TestEvalPriority(t *testing.T) {
620 e, _ := NewEnforcer("examples/eval_operator_model.conf", "examples/eval_operator_policy.csv")

Callers

nothing calls this directly

Calls 4

AddNamedMatchingFuncMethod · 0.95
LoadPolicyMethod · 0.95
NewEnforcerFunction · 0.85
testEnforceFunction · 0.85

Tested by

no test coverage detected