feat: fix auth, provider health checks, search, and redesign UI
- Fix register/login: dict-style access on UserTable ORM objects - Fix HTMX auth: inject JWT token in all HTMX request headers - Fix FS7 search: use DLE AJAX endpoint /engine/ajax/search.php - Fix ZT search: use ?p=series&search=QUERY (not DLE format) - Fix provider health: load hardcoded providers + domain manager - Add self.id to all anime/series providers - Redesign homepage: Netflix-style horizontal scroll cards (.hc) - Redesign search results: grouped by title, poster + synopsis + 3 buttons - Add Télécharger dropdown: season download + episode picker - Fix navbar CSS: restore .tabs flex layout, remove orphan rules - Fix HTMX spinner: remove inline display:none, use CSS indicator - Add AGENTS.md files across project for developer documentation
This commit is contained in:
+33
-41
@@ -1,38 +1,35 @@
|
||||
# AGENTS.md - Test Suite
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
Pytest test suite for Ohm Stream Downloader with 18 test files covering unit and integration tests.
|
||||
Pytest suite: 18+ test files, 5000+ lines. Auto-marked (unit/integration/asyncio) + manual markers (slow/network).
|
||||
|
||||
## STRUCTURE
|
||||
|
||||
```
|
||||
tests/
|
||||
├── conftest.py # Fixtures & pytest config
|
||||
├── test_*.py # 18 test modules
|
||||
├── test_api.py # FastAPI endpoints (integration)
|
||||
├── test_auth.py # JWT authentication
|
||||
├── test_download_manager.py # Download queue management
|
||||
├── test_downloaders.py # Provider downloaders
|
||||
├── test_anime_sama_*.py # Anime-Sama provider variants
|
||||
├── test_favorites.py # Favorites management
|
||||
├── test_french_manga.py # French-Manga provider
|
||||
├── test_models.py # Pydantic model validation
|
||||
├── test_sonarr.py # Sonarr webhook integration
|
||||
├── test_utils.py # Utility functions
|
||||
├── test_watchlist.py # Auto-download watchlist
|
||||
├── test_metadata_enrichment.py
|
||||
├── test_translate_api.py
|
||||
├── test_delete_and_restore.py
|
||||
├── conftest.py # 301 lines: fixtures, markers, DB isolation, event loop
|
||||
├── e2e/ # Playwright end-to-end tests
|
||||
├── test_api.py # 627 lines — FastAPI endpoints (auto integration)
|
||||
├── test_favorites.py # 564 lines — Favorites CRUD
|
||||
├── test_sonarr.py # 513 lines — Sonarr webhook
|
||||
├── test_metadata_enrichment.py # 442 lines — Kitsu API
|
||||
├── test_download_manager.py # 395 lines — Download queue
|
||||
├── test_downloaders.py # 341 lines — Provider scrapers
|
||||
├── test_models.py # 321 lines — Pydantic models
|
||||
├── test_utils.py # 246 lines — sanitize_filename, is_safe_filename
|
||||
└── test_watchlist.py # 178 lines — Auto-download watchlist
|
||||
```
|
||||
|
||||
**Root-level tests** (legacy placement, NOT in tests/):
|
||||
- `test_watchlist_simple.py`, `test_watchlist_e2e.py` — should be moved to tests/
|
||||
|
||||
## WHERE TO LOOK
|
||||
|
||||
| Need | File |
|
||||
|------|------|
|
||||
| Run all tests | `pytest` |
|
||||
| Unit tests only | `pytest -m "unit"` |
|
||||
| Integration tests | `pytest -m "integration"` (test_api.py auto-marked) |
|
||||
| All tests | `pytest` |
|
||||
| Unit only | `pytest -m "unit"` |
|
||||
| Integration only | `pytest -m "integration"` (test_api.py auto-marked) |
|
||||
| Skip slow | `pytest -m "not slow"` |
|
||||
| Download logic | `test_download_manager.py`, `test_downloaders.py` |
|
||||
| API endpoints | `test_api.py` |
|
||||
| Provider scrapers | `test_anime_sama_*.py`, `test_french_manga.py` |
|
||||
@@ -40,25 +37,20 @@ tests/
|
||||
## CONVENTIONS
|
||||
|
||||
**Markers** (auto-applied unless manual):
|
||||
- `unit` - Default for non-api tests
|
||||
- `integration` - test_api.py only
|
||||
- `asyncio` - Auto-detected from coroutine functions
|
||||
- `slow` - Manual: `@pytest.mark.slow`
|
||||
- `network` - Manual: `@pytest.mark.network`
|
||||
- `unit` — Default for non-api tests
|
||||
- `integration` — test_api.py only
|
||||
- `asyncio` — Auto-detected from coroutine functions
|
||||
- `slow` — Manual: `@pytest.mark.slow`
|
||||
- `network` — Manual: `@pytest.mark.network`
|
||||
|
||||
**Naming**:
|
||||
- Files: `test_*.py`
|
||||
- Classes: `Test*` (e.g., `class TestSanitizeFilename:`)
|
||||
- Functions: `test_*` (e.g., `def test_sanitize_simple_filename(self):`)
|
||||
**DB isolation**: `conftest.py` forces `DATABASE_URL=sqlite://` in-memory. Tables auto-drop/recreate per test.
|
||||
|
||||
**Fixtures** (in conftest.py):
|
||||
- `temp_dir` - Temporary directory (auto-cleanup)
|
||||
- `temp_download_dir` - Download folder
|
||||
- `sample_download_task` - DownloadTask instance
|
||||
- `mock_httpx_client` - Mocked AsyncClient
|
||||
- `download_manager` - Pre-configured DownloadManager
|
||||
**Naming**: Files `test_*.py`, classes `Test*`, functions `test_*`.
|
||||
|
||||
**Run commands**:
|
||||
- `pytest` - All tests with coverage
|
||||
- `pytest -m "not slow"` - Skip slow tests
|
||||
- `pytest --cov=app --cov-report=html` - HTML coverage report
|
||||
**Config**: `pytest.ini` — asyncio_mode=auto, timeout=300s, coverage on app/.
|
||||
|
||||
## ANTI-PATTERNS
|
||||
|
||||
- Do NOT add network-dependent tests without `@pytest.mark.network`
|
||||
- Do NOT add slow tests without `@pytest.mark.slow`
|
||||
- Empty `except:` in `test_api.py:429,451` and `test_download_manager.py:357` — known tech debt
|
||||
|
||||
Reference in New Issue
Block a user