test(shipping): 更新订单复核库存与通知流程测试
This commit is contained in:
1 parent
8ec028e6a3
commit
265a6e179a
168 files changed
+9420
-4613
No files matched your search
@@ -16,6 +16,24 @@ from app.services.shipping_notice.progress_audit_contract import (
|
||||
EML_ONLY_PROCESSING_STAGES,
|
||||
SHIPPING_PROCESSING_STAGES,
|
||||
)
|
||||
from app.services.shipping_notice.lifecycle_projection import (
|
||||
LIFECYCLE_STAGE_BY_PROCESSING_STAGE,
|
||||
LIFECYCLE_STAGE_CODES,
|
||||
)
|
||||
|
||||
|
||||
def test_fifteen_processing_stages_all_map_to_a_lifecycle_stage():
|
||||
"""统一口径:每个 SHIPPING_PROCESSING_STAGES 细粒度阶段都必须映射到一个合法 5 业务阶段。
|
||||
|
||||
该映射是「15 阶权威 → 5 阶展示」的唯一桥梁;遗漏任一值会导致工作台/批次中心
|
||||
出现未归类阶段,使前后端阶段口径不一致。此处仅作完整性约束,不改变任何阶段语义。
|
||||
"""
|
||||
for stage in SHIPPING_PROCESSING_STAGES:
|
||||
mapped = LIFECYCLE_STAGE_BY_PROCESSING_STAGE.get(stage)
|
||||
assert mapped is not None, f"SHIPPING_PROCESSING_STAGES.{stage!r} 缺少 15->5 映射"
|
||||
assert mapped in LIFECYCLE_STAGE_CODES, (
|
||||
f"映射目标 {mapped!r} 不是合法 5 业务阶段({tuple(LIFECYCLE_STAGE_CODES)})"
|
||||
)
|
||||
|
||||
|
||||
def test_fifteen_stages_inventory_source_before_review():
|
||||
@@ -32,24 +50,25 @@ def test_fifteen_stages_inventory_source_before_review():
|
||||
def test_sync_order_task_stage_must_be_processing_stage(app):
|
||||
"""任务工作台与对话投影均读 OT.stage;写入值必须是冻结的 15 阶之一。"""
|
||||
with app.app_context():
|
||||
notice = ShippingNotice(
|
||||
task_no='SN-CROSS-SURFACE-001',
|
||||
source_type='manual',
|
||||
po_number='PO-CROSS-001',
|
||||
order_lines_migration_status='pending',
|
||||
)
|
||||
db.session.add(notice)
|
||||
db.session.flush()
|
||||
# [BE-05] 订单数据已迁移到 ShippingOrderTask/Extraction;Notice 不再承载
|
||||
# po_number/order_lines_migration_status。OT 是进度写入口,Notice 通过
|
||||
# order_task_id 反指 OT,恢复测试原本「通知 + 任务」配对结构。
|
||||
order_task = ShippingOrderTask(
|
||||
task_no='OT-CROSS-SURFACE-001',
|
||||
user_id=1,
|
||||
shipping_notice_id=int(notice.id),
|
||||
stage='waiting_review',
|
||||
status='waiting_review',
|
||||
progress_version=1,
|
||||
)
|
||||
db.session.add(order_task)
|
||||
db.session.flush()
|
||||
notice = ShippingNotice(
|
||||
task_no='SN-CROSS-SURFACE-001',
|
||||
source_type='manual',
|
||||
order_task_id=int(order_task.id),
|
||||
)
|
||||
db.session.add(notice)
|
||||
db.session.flush()
|
||||
|
||||
sync_order_task_processing_state(
|
||||
order_task,
|
||||
|
||||
Reference in new issue
Block a user