tests
This commit is contained in:
9
server/testing/conftest.py
Normal file
9
server/testing/conftest.py
Normal 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 #чтобы вернуть значение, но не завершить функцию.
|
||||
Reference in New Issue
Block a user