Files
blog.pyaqa.ru/tests/api/conftest.py
Sergey Vanyushkin 66ce5ae746 init update (#1)
Co-authored-by: Sergey Vanyushkin <pi3c@yandex.ru>
Co-committed-by: Sergey Vanyushkin <pi3c@yandex.ru>
2026-04-25 17:47:07 +00:00

23 lines
570 B
Python

# API test fixtures
# Provides: httpx.AsyncClient, authentication helpers, test API data
import pytest
from httpx import ASGITransport, AsyncClient
@pytest.fixture
async def client():
"""Create async HTTP client for API testing."""
from app.main import app_factory
app = app_factory()
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as ac:
yield ac
@pytest.fixture
def auth_headers():
"""Return mock authentication headers."""
return {"Authorization": "Bearer test_token"}