фикс поллинга накладной
Deploy / deploy (push) Successful in 9m37s

This commit is contained in:
Раис Юсупалиев
2026-06-19 23:52:46 +03:00
parent f82a7c7606
commit 65c07f1da3
3 changed files with 45 additions and 16 deletions
@@ -64,10 +64,10 @@ def test_get_order_parses_status_and_waybill_uuid() -> None:
"statuses": [
{"code": "ACCEPTED", "date_time": "2026-05-24T10:00:00+0000"}
],
"related_entities": [
{"type": "waybill", "uuid": "waybill-uuid-1"}
],
},
"related_entities": [
{"type": "waybill", "uuid": "waybill-uuid-1"}
],
},
request=httpx.Request("GET", "https://api.cdek.test/v2/orders/cdek-order-uuid"),
)
@@ -42,15 +42,17 @@ def test_map_cdek_order_response_extracts_order_uuid_without_waybill() -> None:
def test_map_cdek_order_response_extracts_waybill_from_related_entities() -> None:
result = map_cdek_order_response(
{
"entity": {"uuid": "cdek-order-uuid"},
"related_entities": [
{"type": "delivery", "uuid": "ignored"},
{
"type": "waybill",
"uuid": "waybill-uuid-1",
"url": "https://cdek.test/waybill/1.pdf",
},
],
"entity": {
"uuid": "cdek-order-uuid",
"related_entities": [
{"type": "delivery", "uuid": "ignored"},
{
"type": "waybill",
"uuid": "waybill-uuid-1",
"url": "https://cdek.test/waybill/1.pdf",
},
],
},
}
)
@@ -61,6 +63,26 @@ def test_map_cdek_order_response_extracts_waybill_from_related_entities() -> Non
)
def test_map_cdek_order_response_supports_root_related_entities() -> None:
result = map_cdek_order_response(
{
"entity": {"uuid": "cdek-order-uuid"},
"related_entities": [
{
"type": "waybill",
"uuid": "waybill-uuid-legacy",
},
],
}
)
assert result == CDEKOrderRegistrationResult(
order_uuid="cdek-order-uuid",
waybill_uuid="waybill-uuid-legacy",
waybill_url=None,
)
def test_map_cdek_existing_order_response_returns_waybill_for_duplicate() -> None:
result = map_cdek_existing_order_response(
{
@@ -224,10 +246,10 @@ def test_map_cdek_order_info_response_picks_latest_status_by_date_time() -> None
{"code": "ACCEPTED", "date_time": "2026-05-24T10:00:00+0000"},
{"code": "INVALID", "date_time": "2026-05-24T10:00:05+0000"},
],
"related_entities": [
{"type": "waybill", "uuid": "waybill-uuid-1"}
],
},
"related_entities": [
{"type": "waybill", "uuid": "waybill-uuid-1"}
],
}
)