Put in order · Python course · Module 6: Async and FastAPI

Asynchronous test

Arrange an asynchronous endpoint test:

Items to put in order

  • response = await client.get('/species')
  • @pytest.mark.asyncio
  • assert response.status_code == 200
  • async def test_get_species():
  • async with AsyncClient(transport=ASGITransport(app=app), base_url='http://test') as client:

You can check the correct answer by solving this task in the CodeWorlds game.