apache / apache/casbin-dashboard

Test management page needs to be developed

Open
#54 5 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
88
Forks
46
PR merge metrics
No merged PRs in 30d

Description

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")

```go
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.