Co-authored-by: Sergey Vanyushkin <pi3c@yandex.ru> Co-committed-by: Sergey Vanyushkin <pi3c@yandex.ru>
23 lines
570 B
Python
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"}
|