| 24 | ) |
| 25 | |
| 26 | func 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 | |
| 38 | func testEnforceWithoutUsers(t *testing.T, e *testEngine, obj string, act string, res bool) { |
| 39 | t.Helper() |