Skip to content

Commit 4fdf668

Browse files
committed
test: fixed tests
1 parent 82f2c56 commit 4fdf668

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/routers/test_health.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22

33

44
@patch("app.routers.health.check_db_status")
5-
def test_health(mock_db_status, client):
6-
db_status = {"status": "error", "message": "Database connection failed"}
5+
def test_health_ok(mock_db_status, client):
6+
db_status = {
7+
"status": "ok",
8+
}
79
mock_db_status.return_value = db_status
810
r = client.get("/health")
911
assert r.status_code == 200
1012
assert r.json() == {"status": "ok", "database": db_status}
13+
14+
15+
@patch("app.routers.health.check_db_status")
16+
def test_health_db_error(mock_db_status, client):
17+
db_status = {"status": "error", "message": "Database connection failed"}
18+
mock_db_status.return_value = db_status
19+
r = client.get("/health")
20+
assert r.status_code == 503
21+
assert r.json() == {"status": "error", "database": db_status}

0 commit comments

Comments
 (0)