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

Function TestSetWatcherUpdatable

watcher_update_test.go:29–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestSetWatcherUpdatable(t *testing.T) {
30 e, _ := NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")
31
32 sampleWatcherEx := &SampleWatcherUpdatable{}
33 err := e.SetWatcher(sampleWatcherEx)
34 if err != nil {
35 t.Fatal(err)
36 }
37
38 _ = e.SavePolicy() // calls watcherEx.UpdateForSavePolicy()
39 _, _ = e.UpdatePolicy([]string{"admin", "data1", "read"}, []string{"admin", "data2", "read"}) // calls watcherEx.UpdateForUpdatePolicy()
40}

Callers

nothing calls this directly

Calls 4

SetWatcherMethod · 0.95
SavePolicyMethod · 0.95
UpdatePolicyMethod · 0.95
NewEnforcerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…