MCPcopy Index your code
hub / github.com/coder/coder / fuzzAuthzPrep

Function fuzzAuthzPrep

coderd/coderdtest/authorize_test.go:105–117  ·  view source on GitHub ↗

fuzzAuthzPrep has same action and object types for all calls.

(t *testing.T, prep rbac.PreparedAuthorized, n int, action policy.Action, objectType string)

Source from the content-addressed store, hash-verified

103
104// fuzzAuthzPrep has same action and object types for all calls.
105func fuzzAuthzPrep(t *testing.T, prep rbac.PreparedAuthorized, n int, action policy.Action, objectType string) []coderdtest.ActionObjectPair {
106 t.Helper()
107 pairs := make([]coderdtest.ActionObjectPair, 0, n)
108
109 for i := 0; i < n; i++ {
110 obj := coderdtest.RandomRBACObject()
111 obj.Type = objectType
112 p := coderdtest.ActionObjectPair{Action: action, Object: obj}
113 _ = prep.Authorize(context.Background(), p.Object)
114 pairs = append(pairs, p)
115 }
116 return pairs
117}
118
119func fuzzAuthz(t *testing.T, sub rbac.Subject, rec rbac.Authorizer, n int) []coderdtest.ActionObjectPair {
120 t.Helper()

Callers 1

TestAuthzRecorderFunction · 0.85

Calls 3

RandomRBACObjectFunction · 0.92
HelperMethod · 0.65
AuthorizeMethod · 0.65

Tested by

no test coverage detected