📜  如何在 pytest 中使用 fastapi ApiClient - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:15.256000             🧑  作者: Mango

代码示例1
import pytest


@pytest.mark.asyncio
async def test_middleware2():
    from async_asgi_testclient import TestClient

    async with TestClient(app) as client:
        response = await client.get("/")
        assert "X-Process-Time" in response.headers