MCPcopy Create free account
hub / github.com/apache/casbin-server / testEnforce

Function testEnforce

server/model_test.go:26–36  ·  view source on GitHub ↗
(t *testing.T, e *testEngine, sub string, obj string, act string, res bool)

Source from the content-addressed store, hash-verified

24)
25
26func testEnforce(t *testing.T, e *testEngine, sub string, obj string, act string, res bool) {
27 t.Helper()
28 reply, err := e.s.Enforce(e.ctx, &pb.EnforceRequest{EnforcerHandler: e.h, Params: []string{sub, obj, act}})
29 assert.NoError(t, err)
30
31 if reply.Res != res {
32 t.Errorf("%s, %v, %s: %t, supposed to be %t", sub, obj, act, !res, res)
33 } else {
34 t.Logf("Enforce for %s, %s, %s : %v", sub, obj, act, reply.Res)
35 }
36}
37
38func testEnforceWithoutUsers(t *testing.T, e *testEngine, obj string, act string, res bool) {
39 t.Helper()

Callers 1

TestRoleAPIFunction · 0.85

Calls 1

EnforceMethod · 0.65

Tested by

no test coverage detected