test_ping.py 429 B

123456789101112131415161718
  1. from fastapi.testclient import TestClient
  2. from app.main import app
  3. client = TestClient(app)
  4. def test_web_ping():
  5. response = client.get("/ping")
  6. assert response.status_code == 200
  7. assert response.text == '"pong"'
  8. def test_api_ping():
  9. response = client.get("/api/v1/ping")
  10. assert response.status_code == 200
  11. body = response.json()
  12. assert body["status"] == "OK"
  13. assert body["message"] == "pong"