File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 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 }
You can’t perform that action at this time.
0 commit comments