stability and vps runtime updates
This commit is contained in:
26
tests/test_api_tasks.py
Normal file
26
tests/test_api_tasks.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from iaai_scraper.api.routes.tasks import SyncListingRequest, SyncVehicleRequest
|
||||
|
||||
|
||||
def test_sync_vehicle_request_rejects_empty_vehicle_url() -> None:
|
||||
with pytest.raises(ValidationError):
|
||||
SyncVehicleRequest(vehicle_url=" ")
|
||||
|
||||
|
||||
def test_sync_vehicle_request_normalizes_whitespace_fields() -> None:
|
||||
body = SyncVehicleRequest(vehicle_url=" https://www.iaai.com/VehicleDetails/123 ", lane=" ")
|
||||
|
||||
assert body.vehicle_url == "https://www.iaai.com/VehicleDetails/123"
|
||||
assert body.lane == "iaai"
|
||||
|
||||
|
||||
def test_sync_listing_request_normalizes_empty_filters_and_lane() -> None:
|
||||
body = SyncListingRequest(make=" ", model="\t", lane=" ")
|
||||
|
||||
assert body.make is None
|
||||
assert body.model is None
|
||||
assert body.lane == "iaai_cars"
|
||||
Reference in New Issue
Block a user