This commit is contained in:
zlwu committed 2026-09-01 13:51:32 +08:00
1 parent ba21c40058
commit 0e8f244bc3
16 files changed
+405027 -2098

No files matched your search

@@ -12,6 +12,7 @@ from app.services.pl_plan_stop_service import (
assert_at_most_one_contract,
assert_delivery_products_in_selected_contract,
assert_load_products_in_selected_contract,
assert_stop_contract_required,
)
@@ -217,3 +218,22 @@ def test_assert_delivery_products_skips_internal_customer():
],
)
assert_delivery_products_in_selected_contract(db, "shanxia2.0", delivery, 1)
def test_assert_stop_contract_required_rejects_external_without_contract():
with pytest.raises(HTTPException) as exc:
assert_stop_contract_required("外部客户A", [], "装货客户")
assert exc.value.status_code == 422
assert exc.value.detail == "请为装货客户选择合同"
def test_assert_stop_contract_required_allows_external_with_contract():
links = [PlanContractLink(contractId="c1", contractNo="N1")]
assert_stop_contract_required("外部客户A", links, "装货客户") is None
def test_assert_stop_contract_required_skips_internal_customer():
from app.services.pl_internal_customer import INTERNAL_CUSTOMER_NAMES
internal = next(iter(INTERNAL_CUSTOMER_NAMES))
assert_stop_contract_required(internal, [], "装货客户") is None