From 45a9e4f2db0543e2d24811c2bbe1b67c3e036c3c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 18 Aug 2026 15:33:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20test=5Fstartup=5Fdb?= =?UTF-8?q?=5Funhealthy=20JSONResponse=20=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit startup_check() 不健康时返回 JSONResponse 对象, 不能直接用下标访问,需要先 json.loads(result.body)。 --- tests/unit/test_health_routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_health_routes.py b/tests/unit/test_health_routes.py index c74cd2de6..beb6543a7 100644 --- a/tests/unit/test_health_routes.py +++ b/tests/unit/test_health_routes.py @@ -180,5 +180,7 @@ class TestStartupCheck: result = await startup_check() - assert result["status"] == "starting" assert result.status_code == 503 + import json + body = json.loads(result.body) + assert body["status"] == "starting"