Documentation
¶
Index ¶
- func InsertTestClient(t *testing.T, clientID string, redirectURIs []string)
- func InsertTestConfidentialClient(t *testing.T, clientID, clientSecret string)
- func InsertTestGroup(t *testing.T, groupID, name string)
- func InsertTestGroupMembership(t *testing.T, userID, groupID string)
- func InsertTestUser(t *testing.T, userID string)
- func MockApiRequestWithAuth(t *testing.T, body, method, url string, handler RouteHandler, token string) *httptest.ResponseRecorder
- func MockFormRequest(t *testing.T, formData map[string]string, method, uri string, ...) *httptest.ResponseRecorder
- func MockFormRequestWithBasicAuth(t *testing.T, formData map[string]string, method, uri string, ...) *httptest.ResponseRecorder
- func MockJSONRequest(t *testing.T, body, method, url string, handler RouteHandler) []byte
- func SetAuthorizeSig(v url.Values)
- func SignedURL(rawURL string) string
- func WithConfigOverride(t *testing.T, override func())
- func WithTestDB(t *testing.T)
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertTestClient ¶ added in v1.2.0
InsertTestClient inserts a minimal active OAuth2 client row for tests. redirectURIs is the list of allowed redirect URIs for the client.
func InsertTestConfidentialClient ¶ added in v1.6.6
InsertTestConfidentialClient inserts a confidential OAuth2 client with a known plaintext secret for testing endpoints that require client auth. The secret is bcrypt-hashed before storage, matching production behavior.
func InsertTestGroup ¶ added in v1.6.4
InsertTestGroup inserts a minimal group row for tests.
func InsertTestGroupMembership ¶ added in v1.6.4
InsertTestGroupMembership inserts a user_groups row for tests.
func InsertTestUser ¶ added in v1.0.8
InsertTestUser inserts a minimal valid user row so that foreign-key constraints on user_id are satisfied in tests that don't exercise the user package directly.
func MockApiRequestWithAuth ¶
func MockApiRequestWithAuth(t *testing.T, body, method, url string, handler RouteHandler, token string) *httptest.ResponseRecorder
func MockFormRequest ¶
func MockFormRequest(t *testing.T, formData map[string]string, method, uri string, handler RouteHandler) *httptest.ResponseRecorder
func MockFormRequestWithBasicAuth ¶ added in v1.6.6
func MockFormRequestWithBasicAuth(t *testing.T, formData map[string]string, method, uri string, handler RouteHandler, clientID, clientSecret string) *httptest.ResponseRecorder
MockFormRequestWithBasicAuth is like MockFormRequest but adds HTTP Basic auth.
func MockJSONRequest ¶
func MockJSONRequest(t *testing.T, body, method, url string, handler RouteHandler) []byte
func SetAuthorizeSig ¶ added in v1.6.8
SetAuthorizeSig computes and sets the authorize_sig field on url.Values from the OAuth authorize parameters. Works for both form data and query params.
func SignedURL ¶ added in v1.6.8
SignedURL appends an authorize_sig query param computed from the existing query params in the URL. Useful for passkey begin endpoints.
func WithConfigOverride ¶
func WithTestDB ¶
Types ¶
type RouteHandler ¶
type RouteHandler func(w http.ResponseWriter, r *http.Request)