test(cma): clear 10 pre-existing baseline failures (cma-baseline-tests-cleanup-20260915)
No production code changed. Root causes were all test-side staleness: - test_cash TestVoucherImport: fixture filename contained 'test' -> rejected by the intentional import guard (d71c7fe); renamed, and missing-columns case now asserts the column check is what returns 400 - test_budget_tech_improve TestP1ValueCollect: seeded voucher_details source rows; collector deliberately skips empty aggregates sinced71c7fe(no more implicit 0), and preview call now passes an explicit period - test_roadmap_r2r5 / test_budget / test_ai_suggestions: seeds hardcoded 2026-08 (authoring month) while detectors/rule engine use the current month -> replaced with current-period seeds pytest tests/ -q -rf: 1094 passed, 1 xfailed, 0 failed (baseline was 10 failed, 1084 passed, 1 xfailed)
This commit is contained in:
@@ -234,7 +234,9 @@ class TestVoucherImport:
|
||||
buf.seek(0)
|
||||
return buf
|
||||
|
||||
def _upload(self, client, token, buf, fname="test_vouchers.xlsx"):
|
||||
def _upload(self, client, token, buf, fname="vouchers_import.xlsx"):
|
||||
"""注意: 文件名不得含 test/示例/sample/demo 等测试标识——导入端点有生产防线
|
||||
(d71c7fe「Excel导入示例文件防线」),含标识直接 400,与三条校验规则的用例无关。"""
|
||||
return client.post(
|
||||
f"{BASE}/import/vouchers", headers=auth_header(token),
|
||||
files={"file": (fname, buf,
|
||||
@@ -315,3 +317,4 @@ class TestVoucherImport:
|
||||
buf = self._xlsx([["2026-08-01", "记-001", 100, 0]], cols=["日期", "凭证号", "借方金额", "贷方金额"])
|
||||
resp = self._upload(client, token, buf)
|
||||
assert resp.status_code == 400
|
||||
assert "缺少必要列" in resp.json()["detail"] # 断言是列校验拦下,而非文件名防线
|
||||
|
||||
Reference in New Issue
Block a user