Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Test get_attributes_display_map with no choice object
Mira Szewczykf0c5dc4cf2c5
diff --git a/tests/test_product.py b/tests/test_product.pyindex 06d213a0a4..e2b019e8db 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -4,6 +4,7 @@ from mock import Mockimport pytestfrom django.core.urlresolvers import reverse+from django.utils.encoding import smart_textfrom saleor.cart.models import Cartfrom saleor.cart import CartStatus, utils@@ -293,3 +294,14 @@ def test_get_attributes_display_map_empty(product_with_no_attributes):attributes = product.product_class.product_attributes.all()assert get_attributes_display_map(product, attributes) == {}+++def test_get_attributes_display_map_no_choices(product_in_stock):+ attributes = product_in_stock.product_class.product_attributes.all()+ product_attr = attributes.first()++ product_in_stock.set_attribute(product_attr.pk, -1)+ attributes_display_map = get_attributes_display_map(+ product_in_stock, attributes)++ assert attributes_display_map == {product_attr.pk: smart_text(-1)}