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

Function TestMultiplePolicyDefinitions

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

Source from the content-addressed store, hash-verified

549}
550
551func TestMultiplePolicyDefinitions(t *testing.T) {
552 e, _ := NewEnforcer("examples/multiple_policy_definitions_model.conf", "examples/multiple_policy_definitions_policy.csv")
553 enforceContext := NewEnforceContext("2")
554 enforceContext.EType = "e"
555 testBatchEnforce(t, e, [][]interface{}{
556 {"alice", "data2", "read"},
557 {enforceContext, struct{ Age int }{Age: 70}, "/data1", "read"},
558 {enforceContext, struct{ Age int }{Age: 30}, "/data1", "read"},
559 }, []bool{
560 true, false, true,
561 })
562}
563
564func TestPriorityExplicit(t *testing.T) {
565 e, _ := NewEnforcer("examples/priority_model_explicit.conf", "examples/priority_policy_explicit.csv")

Callers

nothing calls this directly

Calls 3

NewEnforcerFunction · 0.85
NewEnforceContextFunction · 0.85
testBatchEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…