Files
devops-test/webapp/tests/test_app.py
2026-10-03 19:08:48 +03:30

27 lines
546 B
Python

from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_index():
r = client.get("/")
assert r.status_code == 200
def test_health():
r = client.get("/health")
assert r.status_code == 200
assert r.json() == {"status": "ok"}
def test_error_endpoint_returns_500():
assert client.get("/error").status_code == 500
def test_metrics_exposed():
client.get("/health")
r = client.get("/metrics")
assert r.status_code == 200
assert "http_requests_total" in r.text