This commit is contained in:
zlwu committed 2026-10-17 11:46:53 +08:00
1 parent 48dcf991dc
commit be2226e4ca
100 files changed
+61340 -40975

No files matched your search

@@ -0,0 +1,19 @@
"""预签约日期不应到数据库 CHAR(8) 字段才失败。"""
import pytest
from pydantic import ValidationError
from app.api.presign_order import PresignOrderBody
@pytest.mark.parametrize('field', ['orderDate', 'expectedDeliveryDate'])
@pytest.mark.parametrize('value', ['2026-10-15', '2026101', '20261301', '20260230', 'abcdefgh'])
def test_invalid_presign_date_rejected_before_database(field, value):
with pytest.raises(ValidationError):
PresignOrderBody(**{field: value})
@pytest.mark.parametrize('field', ['orderDate', 'expectedDeliveryDate'])
@pytest.mark.parametrize('value', ['20261015', '20240229', '', None])
def test_valid_or_empty_presign_date_keeps_existing_contract(field, value):
body = PresignOrderBody(**{field: value})
assert body.model_dump(by_alias=True)[field] == value