Add application setup and test infrastructure

Application Configuration:
- FastAPI application factory pattern
- CORS middleware for cross-origin support
- Global exception handlers for consistent error responses
  - AppException handler for custom errors
  - RequestValidationError handler for Pydantic validation
  - General exception handler for unexpected errors
- Lifespan management for startup/shutdown events
- Router registration for all API endpoints
- OpenAPI schema with interactive documentation

Models Service:
- Integration with ModelRegistry
- List available models endpoint
- Model capability discovery

Test Infrastructure:
- Pytest configuration with async support
- Test client fixtures for sync and async testing
- Comprehensive main application tests (14 tests):
  - App creation and metadata
  - Router registration verification
  - CORS middleware and functionality
  - Exception handler registration and behavior
  - Lifespan event handling
  - OpenAPI schema generation
  - Documentation accessibility
  - Validation error handling
- Models API tests (2 tests)
- Total: 95 tests, 78.95% coverage

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-06 19:39:02 +01:00
co-authored by Claude
parent 5e40704d91
commit 8b6cff2920
5 changed files with 277 additions and 26 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ async def async_client() -> AsyncClient:
def mock_chat_request() -> dict:
"""Standard chat completion request fixture."""
return {
"model": "mistral-nemo:latest",
"model": "tatlock",
"messages": [
{"role": "user", "content": "Hello, world!"}
],