test(shipping): 更新订单复核库存与通知流程测试
This commit is contained in:
1 parent
8ec028e6a3
commit
265a6e179a
168 files changed
+9420
-4613
No files matched your search
@@ -0,0 +1,20 @@
|
||||
"""锁定 ShippingTaskEvent.task_id 指向正式订单任务,而非旧通知表。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
from app.models import ShippingTaskEvent
|
||||
from app.services.shipping_notice.tool_common import task_event_task_id
|
||||
|
||||
|
||||
def test_shipping_task_event_points_to_order_task():
|
||||
"""审计事件必须接受 ShippingOrderTask.id,避免确认建单时外键失败。"""
|
||||
fk = next(iter(ShippingTaskEvent.__table__.c.task_id.foreign_keys))
|
||||
assert fk.target_fullname == 'shipping_order_tasks.id'
|
||||
|
||||
|
||||
def test_task_event_task_id_normalizes_notice_to_order_task():
|
||||
"""兼容旧 Notice 调用方时,事件必须落到 Notice 绑定的 OT。"""
|
||||
assert task_event_task_id(SimpleNamespace(id=99, order_task_id=28)) == 28
|
||||
assert task_event_task_id(SimpleNamespace(id=99, order_task_id=None)) is None
|
||||
Reference in new issue
Block a user