# AGENTS.md - Test Suite

## OVERVIEW

Pytest test suite for Ohm Stream Downloader with 18 test files covering unit and integration tests.

## 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
```

## 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) |
| Download logic | `test_download_manager.py`, `test_downloaders.py` |
| API endpoints | `test_api.py` |
| Provider scrapers | `test_anime_sama_*.py`, `test_french_manga.py` |

## 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`

**Naming**:
- Files: `test_*.py`
- Classes: `Test*` (e.g., `class TestSanitizeFilename:`)
- Functions: `test_*` (e.g., `def test_sanitize_simple_filename(self):`)

**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

**Run commands**:
- `pytest` - All tests with coverage
- `pytest -m "not slow"` - Skip slow tests
- `pytest --cov=app --cov-report=html` - HTML coverage report
