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

Function TestABACModel

abac_test.go:37–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestABACModel(t *testing.T) {
38 e, _ := NewEnforcer("examples/abac_model.conf")
39
40 data1 := newTestResource("data1", "alice")
41 data2 := newTestResource("data2", "bob")
42
43 testEnforce(t, e, "alice", data1, "read", true)
44 testEnforce(t, e, "alice", data1, "write", true)
45 testEnforce(t, e, "alice", data2, "read", false)
46 testEnforce(t, e, "alice", data2, "write", false)
47 testEnforce(t, e, "bob", data1, "read", false)
48 testEnforce(t, e, "bob", data1, "write", false)
49 testEnforce(t, e, "bob", data2, "read", true)
50 testEnforce(t, e, "bob", data2, "write", true)
51}
52
53func TestABACMapRequest(t *testing.T) {
54 e, _ := NewEnforcer("examples/abac_model.conf")

Callers

nothing calls this directly

Calls 3

NewEnforcerFunction · 0.85
newTestResourceFunction · 0.85
testEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…