feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -105,7 +105,7 @@ def test_enqueue_automark_rejects_annotation_when_current_layout_checksum_change
|
||||
from app.services.shipping_notice import order_document_profile_pdf_automark_service as service
|
||||
|
||||
profile = SimpleNamespace(id=12, status='draft', definition_json={'main_table_id': 'table-1'})
|
||||
annotation = SimpleNamespace(table_id='table-1', layout_version_id=88, layout_payload_checksum='a' * 64)
|
||||
annotation = SimpleNamespace(id=71, document_id=77, table_id='table-1')
|
||||
document = SimpleNamespace(
|
||||
id=77,
|
||||
current_layout_version_id=88,
|
||||
@@ -125,12 +125,22 @@ def test_enqueue_automark_rejects_annotation_when_current_layout_checksum_change
|
||||
'get',
|
||||
lambda model, _ident: document if model is service.ShippingOrderDocument else None,
|
||||
)
|
||||
from app.services.shipping_notice import order_document_profile_service as profile_service
|
||||
monkeypatch.setattr(
|
||||
profile_service,
|
||||
'require_profile_sample_automark_ready',
|
||||
lambda **_kwargs: (_ for _ in ()).throw(ValidationError(
|
||||
'Profile sample layout is stale',
|
||||
code='SHIPPING.ORDER_DOCUMENT_PROFILE_LAYOUT_STALE',
|
||||
)),
|
||||
)
|
||||
monkeypatch.setattr(service, 'enqueue', lambda *_args, **_kwargs: 9001)
|
||||
|
||||
with pytest.raises(ValidationError) as caught:
|
||||
enqueue_pdf_automark(12, document_id=77, table_id='table-1', schema_version_id=3, page_no=1, actor_id=1)
|
||||
|
||||
assert caught.value.code == 'SHIPPING.ORDER_DOCUMENT_PROFILE_INVALID'
|
||||
# Layout 身份不一致必须使用可操作的 stale 错误码,不能退化为泛化配置错误。
|
||||
assert caught.value.code == 'SHIPPING.ORDER_DOCUMENT_PROFILE_LAYOUT_STALE'
|
||||
|
||||
|
||||
def test_execute_automark_rejects_job_after_document_layout_reparse(monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user