feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
tests/test_inventory_empty_snapshot.py
|
||||
|
||||
用途:验证 RPA 零库存结果仅形成审计快照,绝不作为可匹配库存复用。
|
||||
依赖:inventory_snapshot_store、ShippingInventoryFile、Flask 测试应用。
|
||||
逻辑:二期空结果由 Worker/回调写入 empty 快照;查询 ready 快照的运行链路必须忽略它。
|
||||
"""
|
||||
|
||||
from app.services.shipping_notice.inventory_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 repeated.id == first.id
|
||||
assert first.snapshot_status == 'empty'
|
||||
assert first.line_count == 0
|
||||
assert find_latest_ready_snapshot('EMPTY_DUB', 'DUB') is None
|
||||
Reference in new issue
Block a user