| 123456789101112131415161718192021222324252627282930313233343536373839 |
- """车辆/人员 Schema 接受 photoUrls。"""
- from __future__ import annotations
- from app.schemas.pl.base_data import PersonnelCreate, PersonnelUpdate, VehicleCreate, VehicleUpdate
- def test_vehicle_create_accepts_photo_urls():
- body = VehicleCreate.model_validate(
- {
- "vehicleType": "carrier",
- "licensePlate": "皖A12345",
- "vehicleStatus": "available",
- "photoUrls": "pl/vehicle-photo/a.jpg",
- }
- )
- assert body.photo_urls == "pl/vehicle-photo/a.jpg"
- def test_vehicle_update_accepts_photo_urls():
- body = VehicleUpdate.model_validate({"photoUrls": "pl/vehicle-photo/b.jpg"})
- assert body.photo_urls == "pl/vehicle-photo/b.jpg"
- def test_personnel_create_accepts_photo_urls():
- body = PersonnelCreate.model_validate(
- {
- "personnelName": "张三",
- "personnelType": "driver",
- "personnelAffiliation": "self",
- "status": "1",
- "photoUrls": "pl/personnel-photo/c.jpg",
- }
- )
- assert body.photo_urls == "pl/personnel-photo/c.jpg"
- def test_personnel_update_accepts_photo_urls():
- body = PersonnelUpdate.model_validate({"photoUrls": ""})
- assert body.photo_urls == ""
|