Enrich search cards
This commit is contained in:
@@ -4,6 +4,7 @@ import unittest
|
||||
from datetime import datetime, timezone
|
||||
from unittest.mock import patch
|
||||
|
||||
from mobilede_scraper.mobile_de.client import MobileDeClient
|
||||
from mobilede_scraper.mobile_de.models import MobileDeListing, MobileDeSearchPage
|
||||
from mobilede_scraper.mobile_de.scraper import MobileDeScraper
|
||||
|
||||
@@ -61,9 +62,9 @@ class _FakeClient:
|
||||
"attributes": [
|
||||
{"tag": "firstRegistration", "value": "05/2016"},
|
||||
{"tag": "mileage", "value": "71 500 km"},
|
||||
{"tag": "category", "value": "OffRoad"},
|
||||
{"tag": "category", "value": "Внедорожник"},
|
||||
{"tag": "color", "value": "Серый"},
|
||||
{"tag": "wheelDrive", "value": "xDrive"},
|
||||
{"tag": "wheelDrive", "value": "Полный привод"},
|
||||
{"tag": "cubicCapacity", "value": "1 998 ccm"},
|
||||
],
|
||||
"images": ["https://img.example.test/1.jpg"],
|
||||
@@ -71,6 +72,15 @@ class _FakeClient:
|
||||
|
||||
|
||||
class TestMobileDeScraperStreamingSync(unittest.TestCase):
|
||||
def test_worker_client_uses_configured_bounded_pool(self) -> None:
|
||||
with patch.dict("os.environ", {"MOBILEDE_HTTP_POOL_SIZE": "7"}):
|
||||
client = MobileDeClient.for_worker()
|
||||
|
||||
adapter = client.session.get_adapter("https://")
|
||||
self.assertEqual(adapter._pool_connections, 7)
|
||||
self.assertEqual(adapter._pool_maxsize, 7)
|
||||
self.assertTrue(adapter._pool_block)
|
||||
|
||||
def test_sync_search_upserts_each_page_during_run(self) -> None:
|
||||
pages = [
|
||||
MobileDeSearchPage(
|
||||
@@ -151,7 +161,7 @@ class TestMobileDeScraperStreamingSync(unittest.TestCase):
|
||||
id="2",
|
||||
url="https://example.test/2",
|
||||
title="BMW 320",
|
||||
raw={"attr": {"fr": "09/2016", "ml": "115 000 km", "c": "EstateCar", "ecol": "Серый", "cc": "1 998 ccm"}},
|
||||
raw={"attr": {"fr": "09/2016", "ml": "115 000 km", "c": "Универсал", "ecol": "Серый", "cc": "1 998 ccm"}},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user