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

Function TestFilteredPolicyEmptyFilter

filter_test.go:160–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestFilteredPolicyEmptyFilter(t *testing.T) {
161 e, _ := NewEnforcer()
162
163 adapter := fileadapter.NewFilteredAdapter("examples/rbac_with_domains_policy.csv")
164 _ = e.InitWithAdapter("examples/rbac_with_domains_model.conf", adapter)
165
166 if err := e.LoadFilteredPolicy(nil); err != nil {
167 t.Errorf("unexpected error in LoadFilteredPolicy: %v", err)
168 }
169 if e.IsFiltered() {
170 t.Errorf("adapter did not reset the filtered flag correctly")
171 }
172 if err := e.SavePolicy(); err != nil {
173 t.Errorf("unexpected error in SavePolicy: %v", err)
174 }
175}
176
177func TestUnsupportedFilteredPolicy(t *testing.T) {
178 e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", "examples/rbac_with_domains_policy.csv")

Callers

nothing calls this directly

Calls 5

InitWithAdapterMethod · 0.95
LoadFilteredPolicyMethod · 0.95
IsFilteredMethod · 0.95
SavePolicyMethod · 0.95
NewEnforcerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…