Serverless Apps with FastAPI
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122
  1. import pytest
  2. from fastapi import status
  3. from starlette.testclient import TestClient
  4. from main import app
  5. @pytest.fixture
  6. def client():
  7. return TestClient(app)
  8. def test_health_check(client):
  9. """
  10. GIVEN
  11. WHEN health check endpoint is called with GET method
  12. THEN response with status 200 and body OK is returned
  13. """
  14. response = client.get("/api/health-check/")
  15. assert response.status_code == status.HTTP_200_OK
  16. assert response.json() == {"message": "OK"}