Fixed 8 failing integration tests by addressing two root causes:
1. GlobalExceptionHandler returning incorrect HTTP status codes
- Added handling for UnauthorizedAccessException → 401
- Added handling for ArgumentException/InvalidOperationException → 400
- Added handling for DbUpdateException (duplicate key) → 409
- Now correctly maps exception types to HTTP status codes
2. Test isolation issue with shared HttpClient
- Modified DatabaseFixture to create new HttpClient for each test
- Prevents Authorization header pollution between tests
- Ensures clean test state for authentication tests
Test Results:
- Before: 23/31 passed (8 failed)
- After: 31/31 passed (0 failed)
Changes:
- Enhanced GlobalExceptionHandler with proper status code mapping
- Fixed DatabaseFixture.Client to create isolated instances
- All authentication and RBAC tests now pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>