utils

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockAuthCall

func MockAuthCall(t *testing.T, clientID string, clientSecret string, testAccessToken string) httpmock.Responder

func MockAuthCallCounter

func MockAuthCallCounter(t *testing.T, clientID, clientSecret, testAccessToken string, expiresIn int, callCount *int) httpmock.Responder

MockAuthCallCounter creates a mock responder that counts how many times the token endpoint is called. This is useful for testing token caching behavior.

func MockAuthCallWithValidation

func MockAuthCallWithValidation(t *testing.T, clientID, clientSecret, testAccessToken string, expectedScopes []string, expiresIn int) httpmock.Responder

MockAuthCallWithValidation creates a mock responder that validates the OAuth2 client credentials request format according to RFC 6749 section 4.4. It validates: - Authorization header (Basic auth with client_id:client_secret) - Content-Type header (application/x-www-form-urlencoded) - Request body contains grant_type=client_credentials - Request body contains expected scopes (if provided)

func MockAuthErrorResponse

func MockAuthErrorResponse(statusCode int, errorCode, errorDescription string) httpmock.Responder

MockAuthErrorResponse creates a mock responder that returns an OAuth2 error response. This is used to test error handling for authz provider error responses (400, 401, 429, 5xx).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL