把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与 枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa 持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀, 上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
"""
|
|
tests/test_inventory_empty_snapshot.py
|
|
|
|
用途:验证 RPA 零库存结果仅形成审计快照,绝不作为可匹配库存复用。
|
|
依赖:onhand_snapshot_store、FreightRpaOnhandReportFile、Flask 测试应用。
|
|
逻辑:二期空结果由 Worker/回调写入 empty 快照;查询 ready 快照的运行链路必须忽略它。
|
|
"""
|
|
|
|
from app.services.shipping_notice.onhand_snapshot_store import (
|
|
create_empty_rpa_inventory_snapshot,
|
|
find_latest_ready_snapshot,
|
|
)
|
|
|
|
|
|
def test_empty_rpa_snapshot_is_auditable_but_never_available_for_matching(app):
|
|
"""空快照应保留导出事实和幂等身份,但 ready 查询必须返回空。"""
|
|
with app.app_context():
|
|
source = {'source_code': 'EMPTY_DUB', 'warehouse_id': 'DUB', 'connector_type': 'dbs'}
|
|
first = create_empty_rpa_inventory_snapshot(
|
|
source=source, rpa_run_no='EMPTY-RUN-1', schedule_run_id=None,
|
|
trigger_type='scheduled', message='no inventory data',
|
|
)
|
|
repeated = create_empty_rpa_inventory_snapshot(
|
|
source=source, rpa_run_no='EMPTY-RUN-1', schedule_run_id=None,
|
|
trigger_type='scheduled', message='no inventory data',
|
|
)
|
|
|
|
# 关键断言:重放同一空结果不重复写审计;空快照不能污染匹配可用库存池。
|
|
assert first.identity_status == 'unknown'
|
|
assert repeated.id == first.id
|
|
assert first.snapshot_status == 'empty'
|
|
assert first.line_count == 0
|
|
assert find_latest_ready_snapshot('EMPTY_DUB', 'DUB') is None
|