Skip to content

Commit acaa2e7

Browse files
committed
Update testing framework for updates
1 parent 7f6cf6f commit acaa2e7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/commercetools/testing/carts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ def _create_from_draft(
148148
anonymous_id=draft.anonymous_id,
149149
country=draft.country,
150150
inventory_mode=draft.inventory_mode,
151+
discount_codes=[],
152+
direct_discounts=[],
151153
tax_mode=draft.tax_mode or models.TaxMode.PLATFORM,
152154
tax_rounding_mode=draft.tax_rounding_mode or models.RoundingMode.HALF_EVEN,
153-
tax_calculation_mode=draft.tax_calculation_mode
154-
or models.TaxCalculationMode.LINE_ITEM_LEVEL,
155+
tax_calculation_mode=draft.tax_calculation_mode or models.TaxCalculationMode.LINE_ITEM_LEVEL,
156+
item_shipping_addresses=[],
155157
line_items=line_items,
156158
custom_line_items=[],
157159
refused_gifts=[],

src/commercetools/testing/stores.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ def _create_from_draft(
4343
id=str(object_id),
4444
created_at=datetime.datetime.now(datetime.timezone.utc),
4545
last_modified_at=datetime.datetime.now(datetime.timezone.utc),
46+
countries=draft.countries or [],
4647
version=1,
4748
key=draft.key,
4849
name=draft.name,
49-
languages=draft.languages,
50+
languages=draft.languages or [],
5051
distribution_channels=distribution_channels,
5152
supply_channels=supply_channels,
5253
product_selections=draft.product_selections,

tests/platform/test_service_stores.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
def test_store_flow(ct_platform_client: PlatformClient, store_draft):
99
store = ct_platform_client.with_project_key("foo").stores().post(store_draft)
10+
assert store is not None
1011

1112
assert store.id
1213

@@ -16,14 +17,15 @@ def test_store_flow(ct_platform_client: PlatformClient, store_draft):
1617
.with_id(store.id)
1718
.delete(version=store.version)
1819
)
19-
20+
assert deleted_store is not None
2021
assert store.id == deleted_store.id
2122

2223

2324
@pytest.fixture
2425
def store_draft():
2526
return models.StoreDraft(
26-
key="test store", name=models.LocalizedString({"en": "test store"})
27+
key="test store",
28+
name=models.LocalizedString({"en": "test store"})
2729
)
2830

2931

@@ -135,5 +137,6 @@ def test_store_channel_create(
135137
store_draft.distribution_channels = [models.ChannelResourceIdentifier(key="FOO")]
136138

137139
store = ct_platform_client.with_project_key("foo").stores().post(store_draft)
138-
140+
assert store is not None
141+
assert channel is not None
139142
assert store.distribution_channels[0].id == channel.id

0 commit comments

Comments
 (0)