feat(bot-bridge): 新增智享通科目字典写入端点 POST /api/cma/bot/dict/zxt-account — 幂等UPSERT(JSON/CSV)+L3分级+audit留痕, 解除 ops 管道 API 迁移阻塞 (ops-cma-dict-write-endpoint-20260912)

This commit is contained in:
Hermes CI Fix
2026-09-12 10:07:20 +08:00
parent 998da4ebd4
commit af541e9043
5 changed files with 232 additions and 6 deletions
+4 -3
View File
@@ -49,12 +49,12 @@ class TestRiskMapCoverage:
assert not unlabeled, f"以下路由函数缺少 @risk_level 装饰器: {unlabeled}"
def test_risk_level_counts(self):
"""分级统计与方案一致:L1=21(20项清单+risk-levels端点)、L2=6(4项清单+okr/create+bot建议通道)、L3=3、L4=0"""
"""分级统计与方案一致:L1=21(20项清单+risk-levels端点)、L2=6(4项清单+okr/create+bot建议通道)、L3=4(+字典写入)、L4=0"""
from collections import Counter
counts = Counter(API_RISK_MAP.values())
assert counts["L1"] == 21, counts
assert counts["L2"] == 6, counts
assert counts["L3"] == 3, counts
assert counts["L3"] == 4, counts
assert counts["L4"] == 0, "Bot API面不得存在L4端点(安全底线)"
def test_no_l4_bot_endpoints(self):
@@ -91,11 +91,12 @@ class TestRiskLevelsEndpoint:
assert apis["POST /api/cma/bot/kpi-value-with-check"]["risk_level"] == "L2"
assert apis["POST /api/cma/bot/import"]["risk_level"] == "L3"
assert apis["POST /api/cma/bot/import"]["handling"] # 处理方式非空
assert apis["POST /api/cma/bot/dict/zxt-account"]["risk_level"] == "L3"
# 分级统计
assert data["summary"]["L1"] == 21
assert data["summary"]["L2"] == 6
assert data["summary"]["L3"] == 3
assert data["summary"]["L3"] == 4
assert data["summary"]["L4"] == 0