mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 14:34:15 +08:00
release: v1.17.12 — 修复 CI 在新版 FastAPI 上路由注册失败
DELETE /api/v1/strategies/{id} 原用 status_code=204,较新 FastAPI/Starlette
在路由注册阶段(add_api_route)就抛 AssertionError: Status code 204 must
not have a response body,导致 CI ubuntu 矩阵 21 个 web 测试因 fixture
导入 router 连带 ERROR。改为返回 200 + {"deleted": id} 确认体。
This commit is contained in:
@@ -214,9 +214,10 @@ def test_router_create_then_list_get_delete(client: TestClient):
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["snapshot"]["total_return"] == pytest.approx(0.35)
|
||||
|
||||
# 4. 删除
|
||||
# 4. 删除(返回 200 + 确认体,非 204,见路由注释)
|
||||
resp = client.delete(f"/api/v1/strategies/{sid}")
|
||||
assert resp.status_code == 204
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["deleted"] == sid
|
||||
|
||||
# 5. 列表为空
|
||||
assert client.get("/api/v1/strategies").json()["count"] == 0
|
||||
|
||||
Reference in New Issue
Block a user