From f786ff9ae38a8428acbd95d5d4f237de9a28838e Mon Sep 17 00:00:00 2001 From: wecom-fullstack Date: Mon, 12 Oct 2026 23:45:56 +0800 Subject: [PATCH] =?UTF-8?q?test(docs-center):=20=E9=87=91=E4=B8=9D?= =?UTF-8?q?=E9=9B=80=E5=88=86=E7=B1=BB=E6=96=AD=E8=A8=80=E6=94=B9=E3=80=8C?= =?UTF-8?q?=E5=BF=85=E5=A4=87=E5=88=86=E7=B1=BB=E5=9C=A8=E5=9C=BA+?= =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E9=A1=BA=E5=BA=8F=E3=80=8D=EF=BC=88=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=89=A9=E5=B1=95=E4=B8=8D=E5=86=8D=E7=95=99=E5=81=87?= =?UTF-8?q?=E7=BA=A2=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test_prod_content_readable 原硬编码 [term,formula,practice,faq],与生产 categories.json 全等比较; 2026-10-12 14:05 内容目录新增 manual(模块手册,order 5) 后期望值失鲜 ⇒ 基线/改后两棵树同红。 - 改为子集式断言(必备分类在场 + 过滤后相对顺序),不再硬编码全集;分类扩展不再红。 - 同族断言盘点:本文件其余分类断言走 tmp content_dir 自持 categories.json,不依赖生产内容目录,无需改。 --- backend/tests/test_doc_center_20260924.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/tests/test_doc_center_20260924.py b/backend/tests/test_doc_center_20260924.py index 6898e141..6136395c 100644 --- a/backend/tests/test_doc_center_20260924.py +++ b/backend/tests/test_doc_center_20260924.py @@ -209,7 +209,13 @@ class TestProdContentCanary: body = r.json() assert body["available"] is True and body["skipped"] == [], body["skipped"] assert body["count"] >= 20, f"迁移应有 20 篇,实际 {body['count']}" - assert [c["key"] for c in body["categories"]] == ["term", "formula", "practice", "faq"] + # 口径(2026-10-12 失鲜收口):分类集合随内容扩展(当日新增 manual/模块手册,order 5), + # 故只断言「必备分类在场 + 相对顺序正确」,不再硬编码全集,避免下次扩类再留假红。 + keys = [c["key"] for c in body["categories"]] + required = ["term", "formula", "practice", "faq"] + assert set(required) <= set(keys), \ + f"生产内容缺必备分类:{sorted(set(required) - set(keys))};实际 {keys}" + assert [k for k in keys if k in required] == required, f"必备分类相对顺序异常:{keys}" for slug in ("term-kpi", "formula-achievement-rate", "practice-threshold-tips", "faq-data-sync"): d = client.get(f"/api/cma/docs/{slug}", headers=auth_header(token)).json() assert d["title"] and d["content"].strip()