Create client_test.go with comprehensive tests using httptest.Server: - TestNewClient_Defaults: verify default configuration - TestNewClient_WithOptions: test functional options - TestAuthenticate_Success: successful authentication flow - TestAuthenticate_InvalidCredentials: 401 error handling - TestAuthenticate_2FA: 2FA token support - TestTokenRefresh_Auto: automatic token refresh on expiry - TestTokenRefresh_Manual: manual token refresh - TestCurrentUser: get current user information - TestRetryLogic_429: retry on rate limiting - TestRetryLogic_5xx: retry on server errors - TestRetryLogic_ExhaustedRetries: max retries exceeded - TestRetryLogic_ContextCancellation: respect context cancellation - TestCalculateRetryDelay: exponential backoff calculation - TestDefaultRetryConfig: verify default retry settings Add testdata/auth/ fixtures: - login_success.json - current_user.json All 14 tests pass. Closes checkvist-api-8bn
5 lines
75 B
JSON
5 lines
75 B
JSON
{
|
|
"id": 12345,
|
|
"username": "testuser",
|
|
"email": "test@example.com"
|
|
}
|