(t *testing.T)
| 175 | } |
| 176 | |
| 177 | func TestSyncedEnforcerSelfRemovePolicy(t *testing.T) { |
| 178 | for i := 0; i < 10; i++ { |
| 179 | e, _ := NewSyncedEnforcer("examples/basic_model.conf", "examples/basic_policy.csv") |
| 180 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user1", "data1", "read"}) }() |
| 181 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user2", "data2", "read"}) }() |
| 182 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user3", "data3", "read"}) }() |
| 183 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user4", "data4", "read"}) }() |
| 184 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user5", "data5", "read"}) }() |
| 185 | go func() { _, _ = e.SelfAddPolicy("p", "p", []string{"user6", "data6", "read"}) }() |
| 186 | |
| 187 | time.Sleep(100 * time.Millisecond) |
| 188 | |
| 189 | testSyncedEnforcerGetPolicy(t, e, [][]string{ |
| 190 | {"alice", "data1", "read"}, |
| 191 | {"bob", "data2", "write"}, |
| 192 | {"user1", "data1", "read"}, |
| 193 | {"user2", "data2", "read"}, |
| 194 | {"user3", "data3", "read"}, |
| 195 | {"user4", "data4", "read"}, |
| 196 | {"user5", "data5", "read"}, |
| 197 | {"user6", "data6", "read"}, |
| 198 | }) |
| 199 | |
| 200 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user1", "data1", "read"}) }() |
| 201 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user2", "data2", "read"}) }() |
| 202 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user3", "data3", "read"}) }() |
| 203 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user4", "data4", "read"}) }() |
| 204 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user5", "data5", "read"}) }() |
| 205 | go func() { _, _ = e.SelfRemovePolicy("p", "p", []string{"user6", "data6", "read"}) }() |
| 206 | |
| 207 | time.Sleep(100 * time.Millisecond) |
| 208 | testSyncedEnforcerGetPolicy(t, e, [][]string{ |
| 209 | {"alice", "data1", "read"}, |
| 210 | {"bob", "data2", "write"}, |
| 211 | }) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | func TestSyncedEnforcerSelfRemovePolicies(t *testing.T) { |
| 216 | for i := 0; i < 10; i++ { |
nothing calls this directly
no test coverage detected
searching dependent graphs…