Commit graph

1 commit

Author SHA1 Message Date
Justin Hammond
b7537019d9 Add comprehensive test coverage for core packages
- Add tests for internal/errors package (100% coverage)
  - Test all error types: AuthError, PluginError, ValidationError, StorageError
  - Test error creation helpers and convenience functions
  - Test HTTP error mapping and response writing
  - Fix import shadowing issue in http.go

- Add tests for pkg/auth2 package (100% coverage)
  - Test Auth2 instance creation and configuration
  - Test provider registration and retrieval
  - Test concurrent operations for thread safety
  - Test version information functions

- Add tests for pkg/config package (98.5% coverage)
  - Test configuration validation for all sub-configs
  - Test configuration save/load functionality
  - Test logging configuration
  - Fix ConfigureLogging to set Writer to stderr

- Add tests for pkg/user package Manager (86.2% coverage)
  - Test all user management operations
  - Test authentication and password management
  - Test MFA and email verification flows
  - Test account locking/unlocking mechanisms

- Add tests for pkg/auth/providers/basic package (62.5% coverage)
  - Test basic authentication flow
  - Test credential validation
  - Test user state handling (disabled, locked, MFA required)
  - Test time manipulation for testing

- Add tests for pkg/auth/providers package (100% coverage, improved from 28.8%)
  - Add comprehensive tests for registry.go
  - Add tests for time.go including mock time provider
  - Improve tests for provider.go to cover nil details case

- Update .gitignore to exclude coverage files

This significantly improves the overall test coverage of the auth2 library,
with most critical packages now having coverage above the 80% target.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 13:58:56 +08:00