Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/roadmap/text/test_health_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Contract test for the public /health liveness endpoint (issue #34)."""


def test_health_is_public_and_cheap(client, mocker):
client.headers.pop("Authorization")
rate_limit_check = mocker.patch("app.services.rate_limit.check_rate_limit")
redis_ping = mocker.patch("app.services.rate_limit.r.ping")
provider_call = mocker.patch("app.services.risk.ask_deepseek")
assessment = mocker.patch("app.api.analyze.get_assessment")

response = client.get("/health")

assert "Authorization" not in response.request.headers
assert response.status_code == 200
assert response.json() == {"status": "ok"}

rate_limit_check.assert_not_called()
redis_ping.assert_not_called()
provider_call.assert_not_called()
assessment.assert_not_called()