Remets dans l'ordre · Cours Python · Module 6: Async et FastAPI

Test asynchrone

Ordonne un test asynchrone d'un endpoint :

Éléments à remettre dans l'ordre

  • 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:

Tu vérifieras la bonne réponse en résolvant cet exercice dans le jeu CodeWorlds.