- 重构报销状态注册表、审批流路由与平台风险标记 - 完善管家意图规划器与模型计划构建器全链路 - 新增 OCR Worker 脚本、数据库会话管理与通知状态 - 优化文档中心、日志视图、预算中心与员工管理交互 - 增强工作台摘要、图标资源与全局主题样式 - 补充审批路由、状态注册、OCR 服务与管家规划器测试覆盖
66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
from app.services.expense_claim_status_registry import (
|
|
claim_status_code,
|
|
normalize_expense_claim_state,
|
|
)
|
|
from app.services.expense_claim_workflow_constants import (
|
|
APPLICATION_ARCHIVE_STAGE,
|
|
APPLICATION_LINK_STATUS_STAGE,
|
|
ARCHIVE_ACCOUNTING_STAGE,
|
|
FINANCE_APPROVAL_STAGE,
|
|
PAYMENT_PAID_STAGE,
|
|
PAYMENT_PENDING_STAGE,
|
|
)
|
|
|
|
|
|
def test_normalize_legacy_finance_review_to_submitted_finance_stage() -> None:
|
|
state = normalize_expense_claim_state(
|
|
"finance_review",
|
|
"finance_review",
|
|
claim_no="SIM-EXP-2026-0001",
|
|
expense_type="travel",
|
|
)
|
|
|
|
assert state.status == "submitted"
|
|
assert state.approval_stage == FINANCE_APPROVAL_STAGE
|
|
assert state.status_code == 20
|
|
assert state.changed is True
|
|
|
|
|
|
def test_normalize_reimbursement_archive_stage_differs_from_application_done() -> None:
|
|
reimbursement_state = normalize_expense_claim_state(
|
|
"approved",
|
|
"completed",
|
|
claim_no="SIM-EXP-2026-0002",
|
|
expense_type="travel",
|
|
)
|
|
application_state = normalize_expense_claim_state(
|
|
"approved",
|
|
"completed",
|
|
claim_no="AP-20260602-0001",
|
|
expense_type="travel_application",
|
|
)
|
|
|
|
assert reimbursement_state.approval_stage == ARCHIVE_ACCOUNTING_STAGE
|
|
assert application_state.approval_stage == APPLICATION_LINK_STATUS_STAGE
|
|
|
|
|
|
def test_normalize_application_archive_stage_is_distinct_from_approval_done() -> None:
|
|
state = normalize_expense_claim_state(
|
|
"approved",
|
|
APPLICATION_ARCHIVE_STAGE,
|
|
claim_no="AP-20260602-0002",
|
|
expense_type="travel_application",
|
|
)
|
|
|
|
assert state.status == "approved"
|
|
assert state.approval_stage == APPLICATION_ARCHIVE_STAGE
|
|
|
|
|
|
def test_normalize_payment_stages_by_status() -> None:
|
|
pending_state = normalize_expense_claim_state("pending_payment", "payment")
|
|
paid_state = normalize_expense_claim_state("paid", "payment")
|
|
|
|
assert pending_state.approval_stage == PAYMENT_PENDING_STAGE
|
|
assert paid_state.approval_stage == PAYMENT_PAID_STAGE
|
|
assert claim_status_code("paid") == 50
|