import pytest from httpx import AsyncClient, ASGITransport from app.main import app from app.config import settings @pytest.mark.asyncio async def test_root_endpoint(async_client: AsyncClient): response = await async_client.get("/") assert response.status_code == 200 assert response.json()["app"] == settings.APP_NAME @pytest.mark.asyncio async def test_health_endpoint(async_client: AsyncClient): response = await async_client.get("/health") assert response.status_code == 200 assert "status" in response.json() assert response.json()["status"] == "healthy" @pytest.mark.asyncio async def test_lifespan(async_client: AsyncClient): # Testing that the lifespan context manager can be entered/exited # ASGITransport already handles this if used correctly async with ASGITransport(app=app) as transport: # Just entering the context triggers lifespan pass