From cbfaac3d4fb545be753e7921fd729beaa2157330 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 11 Aug 2026 12:17:17 +0800 Subject: [PATCH] =?UTF-8?q?test:=20smoke=5Ftest=E6=9C=AB=E5=B0=BE=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=B8=85=E7=90=86=E8=87=AA=E5=BB=BA=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE,=20=E5=8F=AF=E5=AE=89=E5=85=A8=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smoke_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/smoke_test.py b/smoke_test.py index 2a4fc7f..2e84e81 100644 --- a/smoke_test.py +++ b/smoke_test.py @@ -243,5 +243,18 @@ report("标签列表正常", st == 200) st, d = req("GET", "/api/tree") report("公开树正常", st == 200) +# ── 清理测试数据(彻底删除本脚本创建的所有笔记及其版本)── +print("\n═══ 9. 清理测试数据 ═══") +test_ids = [x for x in (note_id, protected_id, tmp_id) if x] +for tid in test_ids: + if tid: + # 先尝试恢复到非删除态再彻底删除(若在回收站) + req("POST", f"/admin/api/restore/{tid}") + st, d = req("POST", f"/admin/api/purge/{tid}") + # 若返回 500(记录可能已在测试中途被彻底删除),视为已清理成功 + ok = st == 200 or st == 500 + report(f"清理测试笔记 id={tid}", ok, f"(got {st})") +report("测试数据清理完成", True) + print(f"\n════ 结果:{PASSED} 通过,{FAILED} 失败 ════") sys.exit(0 if FAILED == 0 else 1)