fix(strategy): 编辑器代码空白根因=/strategy/files不含code; 加GET /strategy/file/{name}按需拉取; 运行回测改回跳参数页+按策略预填(New.vue读query.class,推翻上轮直接发起) [nas]

This commit is contained in:
2026-08-13 19:40:18 +08:00
parent b9d9285246
commit 82c9edb092
4 changed files with 49 additions and 71 deletions
+14
View File
@@ -53,3 +53,17 @@ def test_file_write_rejects_syntax_error(monkeypatch, tmp_path):
# 故意写语法错误的代码 → 400(py_compile 门禁)
r = c.post("/api/v1/strategy/file/__probe_bad.py", json={"code": "def (:"})
assert r.status_code == 400
def test_file_read_returns_code(monkeypatch, tmp_path):
c = _client(monkeypatch, tmp_path)
files = c.get("/api/v1/strategy/files").json()["files"]
if not files:
return
name = files[0]["name"]
r = c.get(f"/api/v1/strategy/file/{name}")
assert r.status_code == 200, r.text
body = r.json()
assert isinstance(body["code"], str) and body["code"] # 编辑器空白 bug 的回归测试
assert body["name"] == name
assert c.get("/api/v1/strategy/file/__no_such__.py").status_code == 404