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

Function TestSubjectPriorityInFilter

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

Source from the content-addressed store, hash-verified

530}
531
532func TestSubjectPriorityInFilter(t *testing.T) {
533 e, _ := NewEnforcer()
534
535 adapter := fileadapter.NewFilteredAdapter("examples/subject_priority_policy_with_domain.csv")
536 _ = e.InitWithAdapter("examples/subject_priority_model_with_domain.conf", adapter)
537 if err := e.loadFilteredPolicy(&fileadapter.Filter{
538 P: []string{"", "", "domain1"},
539 }); err != nil {
540 t.Errorf("unexpected error in LoadFilteredPolicy: %v", err)
541 }
542
543 testBatchEnforce(t, e, [][]interface{}{
544 {"alice", "data1", "domain1", "write"},
545 {"admin", "data1", "domain1", "write"},
546 }, []bool{
547 true, false,
548 })
549}
550
551func TestMultiplePolicyDefinitions(t *testing.T) {
552 e, _ := NewEnforcer("examples/multiple_policy_definitions_model.conf", "examples/multiple_policy_definitions_policy.csv")

Callers

nothing calls this directly

Calls 4

InitWithAdapterMethod · 0.95
loadFilteredPolicyMethod · 0.95
NewEnforcerFunction · 0.85
testBatchEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…