test: add comprehensive test suite with 89% coverage
- Add tests for all backend modules: config, database, models, services, routes, middleware, and providers - Separate dev dependencies using dependency-groups - Update CLAUDE.md with test commands and project structure - Add .coverage and .pytest_cache to gitignore 88 tests covering: - Authentication and authorization - Model routing and key selection - Async logging with batch processing - All API endpoints (chat, openai, anthropic, health) - LiteLLM wrapper (mocked external calls) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
37
CLAUDE.md
37
CLAUDE.md
@@ -10,8 +10,23 @@ zzrouter is an AI model API proxy service with OpenAI-compatible and Anthropic s
|
||||
|
||||
```
|
||||
zzrouter/
|
||||
├── backend/ # Python FastAPI proxy server
|
||||
└── frontend/ # (placeholder)
|
||||
├── backend/ # Python FastAPI proxy server
|
||||
│ ├── app/ # Application code
|
||||
│ │ ├── middleware/ # Request/response middleware
|
||||
│ │ ├── models/ # Database models
|
||||
│ │ ├── providers/ # AI provider clients (OpenAI, Anthropic)
|
||||
│ │ ├── routes/ # API route handlers
|
||||
│ │ ├── services/ # Business logic
|
||||
│ │ ├── config.py # Configuration settings
|
||||
│ │ ├── database.py # Database setup and utilities
|
||||
│ │ └── main.py # FastAPI app entry point
|
||||
│ ├── data/ # SQLite database files
|
||||
│ ├── tests/ # Test files
|
||||
│ ├── main.py # Server entry point
|
||||
│ └── pyproject.toml # Python dependencies
|
||||
├── frontend/ # Frontend (superpowers skill files only)
|
||||
├── docs/ # Documentation
|
||||
└── .playwright/ # Playwright browser automation
|
||||
```
|
||||
|
||||
## Backend Commands
|
||||
@@ -19,13 +34,25 @@ zzrouter/
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
# Install dependencies
|
||||
# Install dependencies (production only)
|
||||
uv sync
|
||||
|
||||
# Run development server
|
||||
# Install dependencies (with dev tools)
|
||||
uv sync --group dev
|
||||
|
||||
# Run development server (with auto-reload)
|
||||
uv run uvicorn app.main:app --reload --port 8000
|
||||
|
||||
# Run directly
|
||||
# Run production server
|
||||
uv run uvicorn app.main:app --port 8000
|
||||
|
||||
# Run tests
|
||||
uv run pytest -v
|
||||
|
||||
# Run tests with coverage
|
||||
uv run pytest -v --cov=app --cov-report=term-missing
|
||||
|
||||
# Alternative: run directly
|
||||
uv run python main.py
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user