Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to use fastapi ApiClient with pytest

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
Source by github.com #
 
PREVIOUS NEXT
Tagged: #fastapi #ApiClient #pytest
ADD COMMENT
Topic
Name
6+9 =