017 fix returning all tariffs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
from decimal import Decimal
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
@@ -134,6 +135,13 @@ class RecordingHTTPClient:
|
||||
"currency": "RUB",
|
||||
"period_min": 1,
|
||||
"period_max": 2,
|
||||
},
|
||||
{
|
||||
"tariff_name": "Economy",
|
||||
"delivery_sum": "499.00",
|
||||
"currency": "RUB",
|
||||
"period_min": 3,
|
||||
"period_max": 5,
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -341,13 +349,15 @@ observability:
|
||||
adapter_config=settings.adapter,
|
||||
)
|
||||
|
||||
result = asyncio.run(provider.get_price(_make_request()))
|
||||
result = asyncio.run(provider.get_prices(_make_request()))
|
||||
|
||||
assert provider.cache_ttl_seconds == 777
|
||||
assert http_client.auth_timeouts == [7.5]
|
||||
assert http_client.city_lookup_timeouts == [7.5, 7.5]
|
||||
assert http_client.tariff_timeouts == [7.5]
|
||||
assert result.provider == "cdek"
|
||||
assert [price.provider for price in result] == ["cdek", "cdek"]
|
||||
assert [price.service_name for price in result] == ["Express", "Economy"]
|
||||
assert [price.price for price in result] == [Decimal("899.00"), Decimal("499.00")]
|
||||
|
||||
|
||||
def test_provider_uses_default_adapter_timeout_and_cache_ttl() -> None:
|
||||
@@ -361,9 +371,10 @@ def test_provider_uses_default_adapter_timeout_and_cache_ttl() -> None:
|
||||
adapter_config=adapter_config,
|
||||
)
|
||||
|
||||
asyncio.run(provider.get_price(_make_request()))
|
||||
result = asyncio.run(provider.get_prices(_make_request()))
|
||||
|
||||
assert provider.cache_ttl_seconds == 900
|
||||
assert http_client.auth_timeouts == [10.0]
|
||||
assert http_client.city_lookup_timeouts == [10.0, 10.0]
|
||||
assert http_client.tariff_timeouts == [10.0]
|
||||
assert len(result) == 2
|
||||
|
||||
Reference in New Issue
Block a user