persist raw attributes and tighten sync assertions
This commit is contained in:
@@ -25,6 +25,30 @@ class TestCarMapper(unittest.TestCase):
|
||||
# Длина hex-представления SHA-256
|
||||
self.assertEqual(len(record.content_hash), 64)
|
||||
|
||||
def test_content_hash_changes_when_image_set_changes(self) -> None:
|
||||
record_one = self.mapper.map_to_car_record(
|
||||
vehicle_url="https://www.iaai.com/VehicleDetail/45089484~US",
|
||||
vehicle_summary={
|
||||
"make": "Toyota",
|
||||
"model": "Camry",
|
||||
"year": "2014",
|
||||
"image_urls": ["https://vis.iaai.com/resizer?imageKeys=1&width=845&height=633"],
|
||||
},
|
||||
payload_insights={"vehicle_core": {}, "pricing": {}, "damage": {}, "auction": {}, "images": {}},
|
||||
)
|
||||
record_two = self.mapper.map_to_car_record(
|
||||
vehicle_url="https://www.iaai.com/VehicleDetail/45089484~US",
|
||||
vehicle_summary={
|
||||
"make": "Toyota",
|
||||
"model": "Camry",
|
||||
"year": "2014",
|
||||
"image_urls": ["https://vis.iaai.com/resizer?imageKeys=2&width=845&height=633"],
|
||||
},
|
||||
payload_insights={"vehicle_core": {}, "pricing": {}, "damage": {}, "auction": {}, "images": {}},
|
||||
)
|
||||
|
||||
self.assertNotEqual(record_one.content_hash, record_two.content_hash)
|
||||
|
||||
def test_deduplicates_images_by_image_key(self) -> None:
|
||||
urls = [
|
||||
"https://vis.iaai.com/resizer?imageKeys=1&width=200&height=150",
|
||||
|
||||
Reference in New Issue
Block a user