feat: 本体字段治理与风险规则模板执行器重构
- 新增本体字段注册表与字段治理审计脚本 - 重构风险规则模板执行器、DSL 验证与清单分类器 - 完善票据夹服务与差旅请求详情页交互 - 优化趋势图表与总览页数据展示 - 增强报销平台风险分级与模拟公司筛选 - 补充本体字段、风险规则生成与票据夹服务测试覆盖
This commit is contained in:
@@ -123,6 +123,17 @@ def test_ocr_recognize_endpoint_returns_structured_payload(monkeypatch, tmp_path
|
||||
repeated_document = repeated_response.json()["documents"][0]
|
||||
assert repeated_document["receipt_id"] == receipt_id
|
||||
|
||||
duplicate_response = client.post(
|
||||
"/api/v1/ocr/recognize",
|
||||
headers=auth_headers,
|
||||
files=[("files", ("invoice.png", b"fake-image", "image/png"))],
|
||||
)
|
||||
assert duplicate_response.status_code == 200
|
||||
duplicate_document = duplicate_response.json()["documents"][0]
|
||||
assert duplicate_document["receipt_id"] == receipt_id
|
||||
assert duplicate_document["receipt_status"] == "unlinked"
|
||||
assert any("重复上传" in warning for warning in duplicate_document["warnings"])
|
||||
|
||||
all_receipts_response = client.get("/api/v1/receipt-folder?status=all", headers=auth_headers)
|
||||
assert all_receipts_response.status_code == 200
|
||||
assert len(all_receipts_response.json()) == 1
|
||||
@@ -143,9 +154,16 @@ def test_ocr_recognize_endpoint_returns_structured_payload(monkeypatch, tmp_path
|
||||
},
|
||||
)
|
||||
assert update_response.status_code == 200
|
||||
updated_payload = update_response.json()
|
||||
assert update_response.json()["document_type_label"] == "电子发票"
|
||||
assert update_response.json()["amount"] == "108元"
|
||||
|
||||
assert updated_payload["edit_logs"]
|
||||
assert any(
|
||||
change["after"] == updated_payload["amount"]
|
||||
for change in updated_payload["edit_logs"][0]["changes"]
|
||||
)
|
||||
|
||||
preview_response = client.get(f"/api/v1/receipt-folder/{receipt_id}/preview", headers=auth_headers)
|
||||
assert preview_response.status_code == 200
|
||||
assert preview_response.content == b"fake-image"
|
||||
|
||||
Reference in New Issue
Block a user