Add backend and frontend skeleton
This commit is contained in:
30
app/backend/tests/test_health.py
Normal file
30
app/backend/tests/test_health.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from fastapi.testclient import TestClient
|
||||
from hypothesis import given, settings
|
||||
from hypothesis import strategies as st
|
||||
|
||||
from main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_liveness_ok():
|
||||
response = client.get("/healthz")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["status"] == "ok"
|
||||
assert data["service"] == "backend"
|
||||
assert data["environment"]
|
||||
|
||||
|
||||
def test_readiness_ok():
|
||||
response = client.get("/readyz")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "ok"
|
||||
|
||||
|
||||
@given(st.text(min_size=0, max_size=16))
|
||||
@settings(max_examples=10)
|
||||
def test_health_resilient_to_query_noise(noise: str):
|
||||
resp = client.get("/healthz", params={"noise": noise})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["status"] == "ok"
|
||||
Reference in New Issue
Block a user