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

Function TestAllMatchingFunc

rbac/default-role-manager/role_manager_test.go:297–309  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

295}
296
297func TestAllMatchingFunc(t *testing.T) {
298 rm := NewRoleManager(10)
299 rm.AddMatchingFunc("keyMatch2", util.KeyMatch2)
300 rm.AddDomainMatchingFunc("keyMatch2", util.KeyMatch2)
301
302 _ = rm.AddLink("/book/:id", "book_group", "*")
303 // Current role inheritance tree after deleting the links:
304 // *:book_group
305 // |
306 // *:/book/:id
307 testDomainRole(t, rm, "/book/1", "book_group", "domain1", true)
308 testDomainRole(t, rm, "/book/2", "book_group", "domain1", true)
309}
310
311func TestMatchingFuncOrder(t *testing.T) {
312 rm := NewRoleManager(10)

Callers

nothing calls this directly

Calls 5

AddMatchingFuncMethod · 0.95
AddDomainMatchingFuncMethod · 0.95
AddLinkMethod · 0.95
testDomainRoleFunction · 0.85
NewRoleManagerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…