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

Function TestABACMapRequest

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

Source from the content-addressed store, hash-verified

51}
52
53func TestABACMapRequest(t *testing.T) {
54 e, _ := NewEnforcer("examples/abac_model.conf")
55
56 data1 := map[string]interface{}{
57 "Name": "data1",
58 "Owner": "alice",
59 }
60 data2 := map[string]interface{}{
61 "Name": "data2",
62 "Owner": "bob",
63 }
64
65 testEnforce(t, e, "alice", data1, "read", true)
66 testEnforce(t, e, "alice", data1, "write", true)
67 testEnforce(t, e, "alice", data2, "read", false)
68 testEnforce(t, e, "alice", data2, "write", false)
69 testEnforce(t, e, "bob", data1, "read", false)
70 testEnforce(t, e, "bob", data1, "write", false)
71 testEnforce(t, e, "bob", data2, "read", true)
72 testEnforce(t, e, "bob", data2, "write", true)
73}
74
75func TestABACTypes(t *testing.T) {
76 e, _ := NewEnforcer("examples/abac_model.conf")

Callers

nothing calls this directly

Calls 2

NewEnforcerFunction · 0.85
testEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…