(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestDuplicateRuleInAdapter(t *testing.T) { |
| 39 | e, _ := casbin.NewEnforcer("../examples/basic_model.conf") |
| 40 | |
| 41 | _, _ = e.AddPolicy("alice", "data1", "read") |
| 42 | _, _ = e.AddPolicy("alice", "data1", "read") |
| 43 | |
| 44 | testRuleCount(t, e.GetModel(), 1, "p", "p", "AddPolicy") |
| 45 | |
| 46 | e.ClearPolicy() |
| 47 | |
| 48 | // simulate adapter.LoadPolicy with duplicate rules |
| 49 | _ = persist.LoadPolicyArray([]string{"p", "alice", "data1", "read"}, e.GetModel()) |
| 50 | _ = persist.LoadPolicyArray([]string{"p", "alice", "data1", "read"}, e.GetModel()) |
| 51 | |
| 52 | testRuleCount(t, e.GetModel(), 1, "p", "p", "LoadPolicyArray") |
| 53 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…