This commit is contained in:
2025-10-12 15:00:23 +03:00
parent a2aadc82b7
commit a4f9af3e2d
8 changed files with 59 additions and 17 deletions

View File

@@ -0,0 +1,9 @@
import pytest_asyncio
from httpx import AsyncClient, ASGITransport
from server.backend.endpoints import api
@pytest_asyncio.fixture
async def client():
transport = ASGITransport(app=api)#подключение к FastAPI-приложению напрямую
async with AsyncClient(transport=transport, base_url="http://test") as ac: #Имитирует подключение в это приложение, как будто по сети
yield ac #чтобы вернуть значение, но не завершить функцию.