25 lines
1000 B
Python
25 lines
1000 B
Python
import pytest
|
||
from httpx import AsyncClient, ASGITransport
|
||
|
||
# Импортируем наше главное FastAPI приложение
|
||
from app.main import app
|
||
|
||
@pytest.mark.asyncio
|
||
async def test_health_check():
|
||
"""
|
||
Тестирует эндпоинт проверки работоспособности (health check).
|
||
"""
|
||
# Создаем "транспорт", который работает с нашим app,
|
||
# и передаем его в AsyncClient.
|
||
transport = ASGITransport(app=app)
|
||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||
|
||
# Отправляем асинхронный GET-запрос на корневой URL ("/")
|
||
response = await client.get("/")
|
||
|
||
# Проверки остаются без изменений
|
||
assert response.status_code == 200
|
||
assert response.json() == {
|
||
"status": "ok",
|
||
"message": "Welcome to Marquiz Metrica Connector!"
|
||
} |