Skip to content

Commit ae318df

Browse files
qdegraaftleguijt
authored andcommitted
Add setLocalizedDescription action with test
1 parent 49d1c1b commit ae318df

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/commercetools/testing/shipping_methods.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def _create_from_draft(
5555
last_modified_at=datetime.datetime.now(datetime.timezone.utc),
5656
name=draft.name,
5757
description=draft.description,
58+
localized_description=draft.localized_description,
5859
tax_category=draft.tax_category,
5960
zone_rates=zone_rates,
6061
is_default=draft.is_default,
@@ -233,6 +234,7 @@ def urls(self):
233234
"removeShippingRate": remove_shipping_rate,
234235
"removeZone": remove_shipping_zone,
235236
"setDescription": update_attribute("description", "description"),
237+
"setLocalizedDescription": update_attribute("localizedDescription", "localized_description"),
236238
"setKey": update_attribute("key", "key"),
237239
"setPredicate": update_attribute("predicate", "predicate"),
238240
}

tests/platform/test_service_shipping_methods.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,27 @@ def test_shipping_method_update(old_client):
8282
)
8383

8484
assert shipping_method.key == "test-shipping-method"
85+
86+
87+
def test_shipping_method_update(old_client):
88+
shipping_method = old_client.shipping_methods.create(
89+
models.ShippingMethodDraft(
90+
key="test-shipping-method",
91+
name="test shipping method",
92+
tax_category=models.TaxCategoryResourceIdentifier(id="dummy"),
93+
zone_rates=[],
94+
is_default=False,
95+
)
96+
)
97+
98+
assert shipping_method.id
99+
assert shipping_method.localized_description is None
100+
101+
shipping_method = old_client.shipping_methods.update_by_id(
102+
id=shipping_method.id,
103+
version=shipping_method.version,
104+
actions=[models.ShippingMethodSetLocalizedDescriptionAction(
105+
localized_description=models.LocalizedString({"en": "a new lstring"}))],
106+
)
107+
108+
assert shipping_method.localized_description == models.LocalizedString({"en": "a new lstring"})

0 commit comments

Comments
 (0)