Skip to content

Commit c7d69c9

Browse files
committed
Add setShippingRateInputType action to project testing backend
1 parent c874526 commit c7d69c9

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/commercetools/testing/project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(self, storage):
3838
"deleteDaysAfterLastModification": 90,
3939
},
4040
"messages": {"enabled": False, "deleteDaysAfterCreation": 15},
41+
"shippingRateInputType": "",
4142
"externalOAuth": None,
4243
"version": 4,
4344
}
@@ -82,6 +83,9 @@ def change_country_tax_rate_fallback_enabled(
8283
"changeName": update_attribute("name", "name"),
8384
"changeLanguages": update_attribute("languages", "languages"),
8485
"setExternalOAuth": update_attribute("externalOAuth", "external_o_auth"),
86+
"setShippingRateInputType": update_attribute(
87+
"shippingRateInputType", "shipping_rate_input_type"
88+
),
8589
"changeMessagesEnabled": change_messages_enabled,
8690
"changeCountryTaxRateFallbackEnabled": change_country_tax_rate_fallback_enabled,
8791
}

tests/platform/test_service_project.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,42 @@ def test_project_update_change_country_tax_rate_fallback_enabled(old_client):
3030
version=project.version,
3131
)
3232
assert project.carts.country_tax_rate_fallback_enabled is True
33+
34+
35+
def test_project_update_set_shipping_rate_input_type(old_client):
36+
project = old_client.project.get()
37+
assert project.shipping_rate_input_type is None
38+
39+
project = old_client.project.update(
40+
actions=[
41+
models.ProjectSetShippingRateInputTypeAction(
42+
shipping_rate_input_type=models.ShippingRateInputType(
43+
type=models.ShippingRateTierType.CART_VALUE
44+
)
45+
)
46+
],
47+
version=project.version,
48+
)
49+
assert project.shipping_rate_input_type == models.CartValueType()
50+
51+
project = old_client.project.update(
52+
actions=[
53+
models.ProjectSetShippingRateInputTypeAction(
54+
shipping_rate_input_type=models.CartClassificationType(
55+
values=[
56+
models.CustomFieldLocalizedEnumValue(
57+
key="test", label=models.LocalizedString({"en": "test"})
58+
)
59+
]
60+
)
61+
)
62+
],
63+
version=project.version,
64+
)
65+
assert project.shipping_rate_input_type == models.CartClassificationType(
66+
values=[
67+
models.CustomFieldLocalizedEnumValue(
68+
key="test", label=models.LocalizedString({"en": "test"})
69+
)
70+
]
71+
)

0 commit comments

Comments
 (0)