Currently, we have visualized model, adapter, enforcer pages. We also need to add a test page to hold all test cases for an enforcer: https://github.com/casbin/casbin/blob/master/model_test.go
So the enforcer can tested for its correctness at any time. As an example:
A test is: (id, name, created_time, test_cases)
A test_case is: (id=TestBasicModel, test_assertions)
A test_assertion is: (request, true/false)
A request is: (sub="alice", obj="data1", act="read")
func TestBasicModel(t *testing.T) {
e, _ := NewEnforcer("examples/basic_model.conf", "examples/basic_policy.csv")
testEnforce(t, e, "alice", "data1", "read", true)
testEnforce(t, e, "alice", "data1", "write", false)
testEnforce(t, e, "alice", "data2", "read", false)
testEnforce(t, e, "alice", "data2", "write", false)
testEnforce(t, e, "bob", "data1", "read", false)
testEnforce(t, e, "bob", "data1", "write", false)
testEnforce(t, e, "bob", "data2", "read", false)
testEnforce(t, e, "bob", "data2", "write", true)
}
- A test can be bound to one enforcer or multiple enforcers.
- An enforcer can bound to 0, 1 or multiple tests.
A user can click a button to test an enforcer against its bound tests.
Currently, we have visualized model, adapter, enforcer pages. We also need to add a test page to hold all test cases for an enforcer: https://github.com/casbin/casbin/blob/master/model_test.go
So the enforcer can tested for its correctness at any time. As an example:
A test is: (id, name, created_time, test_cases)
A test_case is: (id=TestBasicModel, test_assertions)
A test_assertion is: (request, true/false)
A request is: (sub="alice", obj="data1", act="read")
A user can click a button to test an enforcer against its bound tests.