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

Function TestFailedToLoadPolicy

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

Source from the content-addressed store, hash-verified

596}
597
598func TestFailedToLoadPolicy(t *testing.T) {
599 e, _ := NewEnforcer("examples/rbac_with_pattern_model.conf", "examples/rbac_with_pattern_policy.csv")
600 e.AddNamedMatchingFunc("g2", "matchingFunc", util.KeyMatch2)
601 testEnforce(t, e, "alice", "/book/1", "GET", true)
602 testEnforce(t, e, "bob", "/pen/3", "GET", true)
603 e.SetAdapter(fileadapter.NewAdapter("not found"))
604 _ = e.LoadPolicy()
605 testEnforce(t, e, "alice", "/book/1", "GET", true)
606 testEnforce(t, e, "bob", "/pen/3", "GET", true)
607}
608
609func TestReloadPolicyWithFunc(t *testing.T) {
610 e, _ := NewEnforcer("examples/rbac_with_pattern_model.conf", "examples/rbac_with_pattern_policy.csv")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…