MCPcopy
hub / github.com/apache/casbin / TestSyncedEnforcerSelfAddPolicy

Function TestSyncedEnforcerSelfAddPolicy

enforcer_synced_test.go:88–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestSyncedEnforcerSelfAddPolicy(t *testing.T) {
89 for i := 0; i < 10; i++ {
90 e, _ := NewSyncedEnforcer("examples/basic_model.conf", "examples/basic_policy.csv")
91 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user1", "data1", "read"}) }()
92 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user2", "data2", "read"}) }()
93 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user3", "data3", "read"}) }()
94 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user4", "data4", "read"}) }()
95 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user5", "data5", "read"}) }()
96 go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user6", "data6", "read"}) }()
97 time.Sleep(100 * time.Millisecond)
98
99 testSyncedEnforcerGetPolicy(t, e, [][]string{
100 {"alice", "data1", "read"},
101 {"bob", "data2", "write"},
102 {"user1", "data1", "read"},
103 {"user2", "data2", "read"},
104 {"user3", "data3", "read"},
105 {"user4", "data4", "read"},
106 {"user5", "data5", "read"},
107 {"user6", "data6", "read"},
108 })
109 }
110}
111
112func TestSyncedEnforcerSelfAddPolicies(t *testing.T) {
113 for i := 0; i < 10; i++ {

Callers

nothing calls this directly

Calls 3

SelfAddPolicyMethod · 0.95
NewSyncedEnforcerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…