Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix incorrect test
fowczarekb1b3e9b40517
diff --git a/saleor/product/tasks.py b/saleor/product/tasks.pyindex 993600901e..49a3b5c90f 100644--- a/saleor/product/tasks.py+++ b/saleor/product/tasks.py@@ -5,7 +5,9 @@ from .utils.attributes import get_name_from_attributesdef _update_variants_names(instance, saved_attributes):- """update saved variants name for products type."""+ """After change in attribute value name, all product variant names+ should be updated. Products variant name created from attribute+ names of variants."""initial_attributes = set(instance.variant_attributes.all())attributes_changed = initial_attributes.intersection(saved_attributes)if not attributes_changed:diff --git a/tests/test_product_attributes.py b/tests/test_product_attributes.pyindex 1dc1de7290..6638a0dbd2 100644--- a/tests/test_product_attributes.py+++ b/tests/test_product_attributes.py@@ -72,14 +72,18 @@ def test_generate_name_from_values_empty():assert name == ''-def test_product_type_update_changes_variant_name(product_type):+def test_product_type_update_changes_variant_name(product):new_name = 'test_name'- variant_attr = product_type.variant_attributes.first()- assert not variant_attr.name == new_name- variant_attr.name = new_name- variant_attr.save()- _update_variants_names(product_type, [variant_attr])- assert product_type.variant_attributes.first().name == new_name+ product_variant = product.variants.first()+ assert not product_variant.name == new_name+ attribute = product.product_type.variant_attributes.first()+ attribute_value = attribute.values.first()+ attribute_value.name = new_name+ attribute_value.save()+ _update_variants_names(product.product_type, [attribute])+ product_variant.refresh_from_db()+ assert product_variant.name == new_name+def test_update_variants_changed_does_nothing_with_no_attributes():