Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove __len__ form checkout
fowczarekf9fc03f88983
diff --git a/saleor/checkout/models.py b/saleor/checkout/models.pyindex c5b7376e62..f32d02149a 100644--- a/saleor/checkout/models.py+++ b/saleor/checkout/models.py@@ -110,8 +110,8 @@ class Checkout(ModelWithMetadata):def __iter__(self):return iter(self.lines.all())- def __len__(self):- return self.lines.count()+ # def __len__(self):+ # return self.lines.count()def get_customer_email(self) -> str:return self.user.email if self.user else self.emaildiff --git a/saleor/graphql/meta/mutations.py b/saleor/graphql/meta/mutations.pyindex 89a218f929..9ce05f7b18 100644--- a/saleor/graphql/meta/mutations.py+++ b/saleor/graphql/meta/mutations.py@@ -180,7 +180,7 @@ class ClearMeta(BaseMetadataMutation):instance = cls.get_instance(info, **data)if instance:metadata = data.pop("input")- # TODO: We should refactore clearing meta issue: XXXX+ # TODO: We should refactore clearing meta# Don't forget about test test_clear_public_metadata_remove_empty_namespacestored_data = instance.get_meta(metadata.namespace, metadata.client_name)cleared_value = stored_data.pop(metadata.key, None)diff --git a/tests/test_cart.py b/tests/test_cart.pyindex f2ae0d52fa..6883070d52 100644--- a/tests/test_cart.py+++ b/tests/test_cart.py@@ -62,14 +62,14 @@ def test_get_user_checkout(def test_adding_zero_quantity(checkout, product):variant = product.variants.get()add_variant_to_checkout(checkout, variant, 0)- assert len(checkout) == 0+ assert checkout.lines.count() == 0def test_adding_same_variant(checkout, product):variant = product.variants.get()add_variant_to_checkout(checkout, variant, 1)add_variant_to_checkout(checkout, variant, 2)- assert len(checkout) == 1+ assert checkout.lines.count() == 1assert checkout.quantity == 3subtotal = TaxedMoney(Money("30.00", "USD"), Money("30.00", "USD"))assert calculations.checkout_subtotal(checkout) == subtotal@@ -79,7 +79,7 @@ def test_replacing_same_variant(checkout, product):variant = product.variants.get()add_variant_to_checkout(checkout, variant, 1, replace=True)add_variant_to_checkout(checkout, variant, 2, replace=True)- assert len(checkout) == 1+ assert checkout.lines.count() == 1assert checkout.quantity == 2