def test_discount_code_update(client): discount_code = client.discount_codes.create( types.DiscountCodeDraft( name=types.LocalizedString(en="en-discount_code"), code="1337", is_active=True, )) assert discount_code.code == "1337" discount_code = client.discount_codes.update_by_id( id=discount_code.id, version=discount_code.version, actions=[types.DiscountCodeChangeIsActiveAction(is_active=False)], ) assert discount_code.is_active is False
def post_load(self, data): del data["action"] return types.DiscountCodeChangeIsActiveAction(**data)