feat(shipping-notice): 支持发货通知解析延后至 Dify 画布,优化任务创建流程
This commit is contained in:
1 parent
d46d61bfa1
commit
70e8f700ff
38 files changed
+3215
-714
No files matched your search
@@ -2,14 +2,38 @@ import pytest
|
||||
|
||||
from app import db
|
||||
from app.models import ShippingInventoryMapping, ShippingTask
|
||||
from app.services.shipping_notice.match import match_notice_lines
|
||||
|
||||
|
||||
def _tool_headers(app):
|
||||
app.config["INTEGRATION_API_KEY"] = "test-integration-key"
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
"X-Integration-Key": "test-integration-key",
|
||||
}
|
||||
|
||||
|
||||
def test_match_notice_lines_reports_progress():
|
||||
seen: list[tuple[int, int]] = []
|
||||
|
||||
status, line_results, shortage = match_notice_lines(
|
||||
[
|
||||
{"sku": "A001", "reservation_id": "R-1", "qty": 1},
|
||||
{"sku": "A002", "reservation_id": "R-2", "qty": 2},
|
||||
],
|
||||
[
|
||||
{"sku": "A001", "reservation_id": "R-1", "available_qty": 1},
|
||||
{"sku": "A002", "reservation_id": "R-2", "available_qty": 2},
|
||||
],
|
||||
progress_callback=lambda current, total: seen.append((current, total)),
|
||||
)
|
||||
|
||||
assert status == "fulfillable"
|
||||
assert len(line_results) == 2
|
||||
assert shortage["lines"] == []
|
||||
assert seen == [(1, 2), (2, 2)]
|
||||
|
||||
|
||||
def test_shipping_notice_tool_flow(app, client):
|
||||
headers = _tool_headers(app)
|
||||
|
||||
|
||||
Reference in new issue
Block a user