Skip to content

Commit 489cdfc

Browse files
committed
Testing: convert ExternalTaxRateDraft to TaxRate
1 parent 8a2131c commit 489cdfc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/commercetools/testing/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def create_from_draft(draft: typing.Optional[_BaseType]):
8989
for portion in draft.tax_portions
9090
],
9191
)
92+
if isinstance(draft, models.ExternalTaxRateDraft):
93+
return models.TaxRate(
94+
id=str(uuid.uuid4()),
95+
name=draft.name,
96+
amount=draft.amount,
97+
included_in_price=draft.included_in_price,
98+
country=draft.country,
99+
state=draft.state,
100+
sub_rates=draft.sub_rates,
101+
)
92102

93103
raise ValueError(f"Unsupported type {draft.__class__}")
94104

0 commit comments

Comments
 (0)