Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update product type and mutations - allow to update slug
IKarbowiakcc99b5f1dd3d
diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex 98edf09fee..00c013bdd4 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -507,6 +507,7 @@ class ProductInput(graphene.InputObjectType):description="Determines if product is visible to customers.")name = graphene.String(description="Product name.")+ slug = graphene.String(description="Product slug.")base_price = Decimal(description="Product price.")tax_code = graphene.String(description="Tax rate for enabled tax gateway.")seo = SeoInput(description="Search engine optimization fields.")@@ -794,6 +795,15 @@ class ProductCreate(ModelMutation):instance.product_type if instance.pk else cleaned_input.get("product_type")) # type: models.ProductType+ if (+ not instance.slug+ and "slug" not in cleaned_input+ and "name" in cleaned_input+ ):+ cleaned_input["slug"] = generate_unique_slug(+ instance, slugable_value=cleaned_input["name"]+ )+# Try to get price from "basePrice" or "price" field. Once "price" is removed# from the schema, only "basePrice" should be used here.price = data.get("base_price", data.get("price"))diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 65e9e090b8..f30c204ce8 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -464,8 +464,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):)translation = TranslationField(ProductTranslation, type_name="product")- slug = graphene.String(required=True, description="The slug of a product.")-class Meta:description = "Represents an individual item for sale in the storefront."interfaces = [relay.Node]@@ -478,6 +476,7 @@ class Product(CountableDjangoObjectType, MetadataObjectType):"id","is_published","name",+ "slug","product_type","publication_date","seo_description",@@ -609,10 +608,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):def resolve_meta(root, _info):return resolve_meta(root, _info)- @staticmethod- def resolve_slug(root: models.Product, *_args):- return root.get_slug()-@staticmethoddef __resolve_reference(root, _info, **_kwargs):return graphene.Node.get_node_from_global_id(_info, root.id)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 63535ad89f..3c0fca4e24 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -3052,6 +3052,7 @@ type Product implements Node {publicationDate: DateisPublished: Boolean!productType: ProductType!+ slug: String!category: CategoryupdatedAt: DateTimechargeTaxes: Boolean!@@ -3073,7 +3074,6 @@ type Product implements Node {images: [ProductImage]collections: [Collection]translation(languageCode: LanguageCodeEnum!): ProductTranslation- slug: String!}type ProductBulkDelete {@@ -3127,6 +3127,7 @@ input ProductCreateInput {descriptionJson: JSONStringisPublished: Booleanname: String+ slug: StringbasePrice: DecimaltaxCode: Stringseo: SeoInput@@ -3238,6 +3239,7 @@ input ProductInput {descriptionJson: JSONStringisPublished: Booleanname: String+ slug: StringbasePrice: DecimaltaxCode: Stringseo: SeoInputdiff --git a/tests/api/test_bulk_delete.py b/tests/api/test_bulk_delete.pyindex 91f7c01c7c..085aa1a04e 100644--- a/tests/api/test_bulk_delete.py+++ b/tests/api/test_bulk_delete.py@@ -210,6 +210,7 @@ def test_delete_categories_with_subcategories_and_products(category.save()parent_product = Product.objects.get(pk=product.pk)+ parent_product.slug = "parent-product"parent_product.id = Noneparent_product.category = category_list[0]parent_product.save()diff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex ebd14bf605..8a65c5edf4 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -213,7 +213,7 @@ def test_product_query(staff_api_client, product, permission_manage_products, stproduct_data = product_edges_data[0]["node"]assert product_data["name"] == product.nameassert product_data["url"] == product.get_absolute_url()- assert product_data["slug"] == product.get_slug()+ assert product_data["slug"] == product.sluggross = product_data["pricing"]["priceRange"]["start"]["gross"]assert float(gross["amount"]) == float(product.price.amount)from saleor.product.utils.costs import get_product_costs_data@@ -244,6 +244,7 @@ def test_products_query_with_filter_attributes(second_product = productsecond_product.id = Nonesecond_product.product_type = product_type+ second_product.slug = "second-product"second_product.save()associate_attribute_values_to_instance(second_product, attribute, attr_value)@@ -274,6 +275,7 @@ def test_products_query_with_filter_product_type(second_product = productsecond_product.id = Nonesecond_product.product_type = product_type+ second_product.slug = "second-product"second_product.save()product_type_id = graphene.Node.to_global_id("ProductType", product_type.id)@@ -296,6 +298,7 @@ def test_products_query_with_filter_category(category = Category.objects.create(name="Custom", slug="custom")second_product = productsecond_product.id = None+ second_product.slug = "second-product"second_product.category = categorysecond_product.save()@@ -318,6 +321,7 @@ def test_products_query_with_filter_has_category_false(second_product = productsecond_product.category = Nonesecond_product.id = None+ second_product.slug = "second-product"second_product.save()variables = {"filter": {"hasCategory": False}}@@ -342,6 +346,7 @@ def test_products_query_with_filter_has_category_true(second_product = product_without_categorysecond_product.category = categorysecond_product.id = None+ second_product.slug = "second-product"second_product.save()variables = {"filter": {"hasCategory": True}}@@ -365,6 +370,7 @@ def test_products_query_with_filter_collection():second_product = productsecond_product.id = None+ second_product.slug = "second-product"second_product.save()second_product.collections.add(collection)@@ -405,6 +411,7 @@ def test_products_query_with_filter(second_product = productsecond_product.id = Nonesecond_product.name = "Apple Juice1"+ second_product.slug = "apple-juice1"second_product.price = Money("6.00", "USD")second_product.minimal_variant_price = Money("1.99", "USD")second_product.is_published = products_filter.get("isPublished", True)@@ -612,6 +619,7 @@ def test_sort_products(user_api_client, product):# Create the second product with higher price and dateproduct.pk = None+ product.slug = "second-product"product.price = Money("20.00", "USD")product.minimal_variant_price = Money("20.00", "USD")product.updated_at = datetime.utcnow()@@ -688,6 +696,7 @@ def test_sort_products(user_api_client, product):def test_sort_products_published(staff_api_client, product, permission_manage_products):# Create the second not published product+ product.slug = "second-product"product.pk = Noneproduct.is_published = Falseproduct.save()@@ -742,40 +751,12 @@ def test_sort_products_product_type_name(assert product_type_name_0 < product_type_name_1-def test_create_product(- staff_api_client,- product_type,- category,- size_attribute,- description_json,- description_raw,- permission_manage_products,- settings,- monkeypatch,-):- query = """- mutation createProduct(- $productTypeId: ID!,- $categoryId: ID!,- $name: String!,- $descriptionJson: JSONString!,- $isPublished: Boolean!,- $chargeTaxes: Boolean!,- $taxCode: String!,- $basePrice: Decimal!,- $attributes: [AttributeValueInput!]) {+CREATE_PRODUCT_MUTATION = """+ mutation createProduct(+ $input: ProductCreateInput!+ ) {productCreate(- input: {- category: $categoryId,- productType: $productTypeId,- name: $name,- descriptionJson: $descriptionJson,- isPublished: $isPublished,- chargeTaxes: $chargeTaxes,- taxCode: $taxCode,- basePrice: $basePrice,- attributes: $attributes- }) {+ input: $input) {product {category {name@@ -788,6 +769,7 @@ def test_create_product(description}name+ slugbasePrice {amount}@@ -809,8 +791,21 @@ def test_create_product(}}}- """+"""++def test_create_product(+ staff_api_client,+ product_type,+ category,+ size_attribute,+ description_json,+ description_raw,+ permission_manage_products,+ settings,+ monkeypatch,+):+ query = CREATE_PRODUCT_MUTATIONsettings.USE_JSON_CONTENT = Truedescription_json = json.dumps(description_json)@@ -818,6 +813,7 @@ def test_create_product(product_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)category_id = graphene.Node.to_global_id("Category", category.pk)product_name = "test name"+ product_slug = "product-test-slug"product_is_published = Trueproduct_charge_taxes = Trueproduct_tax_rate = "STANDARD"@@ -842,18 +838,21 @@ def test_create_product(# test creating root productvariables = {- "productTypeId": product_type_id,- "categoryId": category_id,- "name": product_name,- "descriptionJson": description_json,- "isPublished": product_is_published,- "chargeTaxes": product_charge_taxes,- "taxCode": product_tax_rate,- "basePrice": product_price,- "attributes": [- {"id": color_attr_id, "values": [color_value_slug]},- {"id": size_attr_id, "values": [non_existent_attr_value]},- ],+ "input": {+ "productType": product_type_id,+ "category": category_id,+ "name": product_name,+ "slug": product_slug,+ "descriptionJson": description_json,+ "isPublished": product_is_published,+ "chargeTaxes": product_charge_taxes,+ "taxCode": product_tax_rate,+ "basePrice": product_price,+ "attributes": [+ {"id": color_attr_id, "values": [color_value_slug]},+ {"id": size_attr_id, "values": [non_existent_attr_value]},+ ],+ }}response = staff_api_client.post_graphql(@@ -863,6 +862,7 @@ def test_create_product(data = content["data"]["productCreate"]assert data["errors"] == []assert data["product"]["name"] == product_name+ assert data["product"]["slug"] == product_slugassert data["product"]["descriptionJson"] == description_jsonassert data["product"]["isPublished"] == product_is_publishedassert data["product"]["chargeTaxes"] == product_charge_taxes@@ -878,6 +878,63 @@ def test_create_product(assert color_value_slug in values+def test_create_product_no_slug_in_input(+ staff_api_client,+ product_type,+ category,+ size_attribute,+ description_json,+ description_raw,+ permission_manage_products,+ settings,+ monkeypatch,+):+ query = CREATE_PRODUCT_MUTATION+ settings.USE_JSON_CONTENT = True++ description_json = json.dumps(description_json)++ product_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)+ category_id = graphene.Node.to_global_id("Category", category.pk)+ product_name = "test name"+ product_is_published = True+ product_tax_rate = "STANDARD"+ product_price = "22.33"++ # Mock tax interface with fake response from tax gateway+ monkeypatch.setattr(+ ExtensionsManager,+ "get_tax_code_from_object_meta",+ lambda self, x: TaxType(description="", code=product_tax_rate),+ )++ # test creating root product+ variables = {+ "input": {+ "productType": product_type_id,+ "category": category_id,+ "name": product_name,+ "isPublished": product_is_published,+ "taxCode": product_tax_rate,+ "basePrice": product_price,+ }+ }++ response = staff_api_client.post_graphql(+ query, variables, permissions=[permission_manage_products]+ )+ content = get_graphql_content(response)+ data = content["data"]["productCreate"]+ assert data["errors"] == []+ assert data["product"]["name"] == product_name+ assert data["product"]["slug"] == "test-name"+ assert data["product"]["isPublished"] == product_is_published+ assert data["product"]["taxType"]["taxCode"] == product_tax_rate+ assert data["product"]["productType"]["name"] == product_type.name+ assert data["product"]["category"]["name"] == category.name+ assert str(data["product"]["basePrice"]["amount"]) == product_price++QUERY_CREATE_PRODUCT_WITHOUT_VARIANTS = """mutation createProduct($productTypeId: ID!,@@ -900,6 +957,7 @@ QUERY_CREATE_PRODUCT_WITHOUT_VARIANTS = """product {idname+ slugvariants{idsku@@ -931,6 +989,7 @@ def test_create_product_without_variants(product_type_id = graphene.Node.to_global_id("ProductType", product_type.pk)category_id = graphene.Node.to_global_id("Category", category.pk)product_name = "test name"+ product_slug = "test-name"product_price = 10sku = "sku"track_inventory = True@@ -951,6 +1010,7 @@ def test_create_product_without_variants(data = content["data"]["productCreate"]assert data["errors"] == []assert data["product"]["name"] == product_name+ assert data["product"]["slug"] == product_slugassert data["product"]["productType"]["name"] == product_type.nameassert data["product"]["category"]["name"] == category.nameassert data["product"]["variants"][0]["sku"] == sku@@ -1168,6 +1228,7 @@ def test_update_product($productId: ID!,$categoryId: ID!,$name: String!,+ $slug: String!,$descriptionJson: JSONString!,$isPublished: Boolean!,$chargeTaxes: Boolean!,@@ -1179,6 +1240,7 @@ def test_update_product(input: {category: $categoryId,name: $name,+ slug: $slug,descriptionJson: $descriptionJson,isPublished: $isPublished,chargeTaxes: $chargeTaxes,@@ -1198,6 +1260,7 @@ def test_update_product(description}name+ slugbasePrice {amount}@@ -1230,6 +1293,7 @@ def test_update_product(product_id = graphene.Node.to_global_id("Product", product.pk)category_id = graphene.Node.to_global_id("Category", non_default_category.pk)product_name = "updated name"+ product_slug = "updated-product"product_is_published = Trueproduct_charge_taxes = Trueproduct_tax_rate = "STANDARD"@@ -1249,6 +1313,7 @@ def test_update_product("productId": product_id,"categoryId": category_id,"name": product_name,+ "slug": product_slug,"descriptionJson": other_description_json,"isPublished": product_is_published,"chargeTaxes": product_charge_taxes,@@ -1264,6 +1329,7 @@ def test_update_product(data = content["data"]["productUpdate"]assert data["errors"] == []assert data["product"]["name"] == product_name+ assert data["product"]["slug"] == product_slugassert data["product"]["descriptionJson"] == other_description_jsonassert data["product"]["isPublished"] == product_is_publishedassert data["product"]["chargeTaxes"] == product_charge_taxes@@ -1531,7 +1597,7 @@ def test_update_product_without_variants_sku_duplication(assert data["errors"][0]["message"] == "Product with this SKU already exists."-def test_update_product_withput_category_and_true_is_published_value(+def test_update_product_without_category_and_true_is_published_value(staff_api_client, permission_manage_products, product):query = """@@ -1574,6 +1640,72 @@ def test_update_product_withput_category_and_true_is_published_value()+UPDATE_PRODUCT = """+ mutation updateProduct(+ $productId: ID!,+ $input: ProductInput!)+ {+ productUpdate(+ id: $productId,+ input: $input)+ {+ product {+ id+ name+ slug+ }+ errors {+ message+ field+ }+ }+ }"""+++def test_update_product_name(staff_api_client, permission_manage_products, product):+ query = UPDATE_PRODUCT++ product_slug = product.slug+ new_name = "example-product"+ assert new_name != product.name++ product_id = graphene.Node.to_global_id("Product", product.id)+ variables = {"productId": product_id, "input": {"name": new_name}}++ response = staff_api_client.post_graphql(+ query, variables, permissions=[permission_manage_products]+ )++ data = get_graphql_content(response)["data"]["productUpdate"]+ assert data["product"]["name"] == new_name+ assert data["product"]["slug"] == product_slug+++def test_update_product_slug_with_existing_value(+ staff_api_client, permission_manage_products, product+):+ query = UPDATE_PRODUCT+ second_product = Product.objects.get(pk=product.pk)+ second_product.id = None+ second_product.slug = "second-product"+ second_product.save()++ assert product.slug != second_product.slug++ product_id = graphene.Node.to_global_id("Product", product.id)+ variables = {"productId": product_id, "input": {"slug": second_product.slug}}++ response = staff_api_client.post_graphql(+ query, variables, permissions=[permission_manage_products]+ )++ data = get_graphql_content(response)["data"]["productUpdate"]+ errors = data["errors"]+ assert errors+ assert errors[0]["field"] == "slug"+ assert errors[0]["message"] == "Product with this Slug already exists."++def test_delete_product(staff_api_client, product, permission_manage_products):query = """mutation DeleteProduct($id: ID!) {@@ -2087,6 +2219,7 @@ def test_assign_variant_image_from_different_product(query = ASSIGN_VARIANT_QUERYvariant = product_with_image.variants.first()product_with_image.pk = None+ product_with_image.slug = "product-with-image"product_with_image.save()image_2 = ProductImage.objects.create(product=product_with_image)@@ -2632,6 +2765,7 @@ def test_categories_query_with_sort()Product.objects.create(name="Test",+ slug="test",price=Money(10, "USD"),product_type=product_type,category=cat1,@@ -2654,6 +2788,7 @@ def test_categories_query_with_sort()Product.objects.create(name="Test2",+ slug="test2",price=Money(10, "USD"),product_type=product_type,category=subsubcat,diff --git a/tests/api/test_product_sorting_attributes.py b/tests/api/test_product_sorting_attributes.pyindex 5a052d249d..fd4cfe83c3 100644--- a/tests/api/test_product_sorting_attributes.py+++ b/tests/api/test_product_sorting_attributes.py@@ -97,6 +97,7 @@ def products_structures(category):[product_models.Product(name=f"{attrs[0]} Apple - {attrs[1]} ({i})",+ slug=f"{attrs[0]}-apple-{attrs[1]}-({i})",product_type=pt_apples,category=category,price=zero_money(),@@ -112,6 +113,7 @@ def products_structures(category):[product_models.Product(name=f"{attrs[0]} Orange - {attrs[1]} ({i})",+ slug=f"{attrs[0]}-orange-{attrs[1]}-({i})",product_type=pt_oranges,category=category,price=zero_money(),@@ -124,6 +126,7 @@ def products_structures(category):dummy = product_models.Product.objects.create(name=f"Oopsie Dummy",+ slug="oopsie-dummy",product_type=pt_other,category=category,price=zero_money(),@@ -131,6 +134,7 @@ def products_structures(category):)product_models.Product.objects.create(name=f"Another Dummy but first in ASC and has no attribute value",+ slug="another-dummy",product_type=pt_other,category=category,price=zero_money(),@@ -491,19 +495,19 @@ def test_sort_product_not_having_attribute_data(api_client, category, count_quer# Create a product with a valueproduct_having_attr_value = product_models.Product.objects.create(- name="Z", product_type=product_type, **product_create_kwargs+ name="Z", slug="z", product_type=product_type, **product_create_kwargs)associate_attribute_values_to_instance(product_having_attr_value, attribute, value)# Create a product having the same product type but no attribute dataproduct_models.Product.objects.create(- name="Y", product_type=product_type, **product_create_kwargs+ name="Y", slug="y", product_type=product_type, **product_create_kwargs)# Create a new product having a name that would be ordered first in ascending# as the default ordering is by name for non matching productsproduct_models.Product.objects.create(- name="A", product_type=other_product_type, **product_create_kwargs+ name="A", slug="a", product_type=other_product_type, **product_create_kwargs)# Sort the productsdiff --git a/tests/conftest.py b/tests/conftest.pyindex 86b51e391f..78f18ac34b 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -511,6 +511,7 @@ def categories_tree(db, product_type): # pylint: disable=W0613product = Product.objects.create(name="Test product",+ slug="test-product-10",price=Money(10, "USD"),product_type=product_type,category=child,@@ -600,6 +601,7 @@ def product(product_type, category, warehouse):product = Product.objects.create(name="Test product",+ slug="test-product-11",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -626,6 +628,7 @@ def product(product_type, category, warehouse):def product_with_single_variant(product_type, category, warehouse):product = Product.objects.create(name="Test product with single variant",+ slug="test-product-with-single-variant",price=Money("1.99", "USD"),product_type=product_type,category=category,@@ -644,6 +647,7 @@ def product_with_single_variant(product_type, category, warehouse):def product_with_two_variants(product_type, category, warehouse):product = Product.objects.create(name="Test product with two variants",+ slug="test-product-with-two-variant",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -688,6 +692,7 @@ def product_with_variant_with_two_attributes(product = Product.objects.create(name="Test product with two variants",+ slug="test-product-with-two-variant",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -736,6 +741,7 @@ def product_with_multiple_values_attributes(product, product_type, category) ->def product_with_default_variant(product_type_without_variant, category, warehouse):product = Product.objects.create(name="Test product",+ slug="test-product-3",price=Money(10, "USD"),product_type=product_type_without_variant,category=category,@@ -779,6 +785,7 @@ def product_without_shipping(category, warehouse):)product = Product.objects.create(name="Test product",+ slug="test-product-4",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -808,6 +815,7 @@ def product_list(product_type, category, warehouse):Product(pk=1486,name="Test product 1",+ slug="test-product-a",price=Money(10, "USD"),category=category,product_type=product_type,@@ -816,6 +824,7 @@ def product_list(product_type, category, warehouse):Product(pk=1487,name="Test product 2",+ slug="test-product-b",price=Money(20, "USD"),category=category,product_type=product_type,@@ -824,6 +833,7 @@ def product_list(product_type, category, warehouse):Product(pk=1489,name="Test product 3",+ slug="test-product-c",price=Money(20, "USD"),category=category,product_type=product_type,@@ -903,6 +913,7 @@ def product_with_image(product, image, media_root):def unavailable_product(product_type, category):product = Product.objects.create(name="Test product",+ slug="test-product-5",price=Money("10.00", "USD"),product_type=product_type,is_published=False,@@ -915,6 +926,7 @@ def unavailable_product(product_type, category):def unavailable_product_with_variant(product_type, category, warehouse):product = Product.objects.create(name="Test product",+ slug="test-product-6",price=Money("10.00", "USD"),product_type=product_type,is_published=False,@@ -939,6 +951,7 @@ def unavailable_product_with_variant(product_type, category, warehouse):def product_with_images(product_type, category, media_root):product = Product.objects.create(name="Test product",+ slug="test-product-7",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -1050,6 +1063,7 @@ def gift_card_created_by_staff(staff_user):def order_with_lines(order, product_type, category, shipping_zone, warehouse):product = Product.objects.create(name="Test product",+ slug="test-product-8",price=Money("10.00", "USD"),product_type=product_type,category=category,@@ -1076,6 +1090,7 @@ def order_with_lines(order, product_type, category, shipping_zone, warehouse):product = Product.objects.create(name="Test product 2",+ slug="test-product-9",price=Money("20.00", "USD"),product_type=product_type,category=category,@@ -1602,6 +1617,7 @@ def digital_content(category, media_root, warehouse) -> DigitalContent:)product = Product.objects.create(name="Test digital product",+ slug="test-digital-product",price=Money("10.00", "USD"),product_type=product_type,category=category,diff --git a/tests/test_discounts.py b/tests/test_discounts.pyindex 03646f4622..bc24f9d00e 100644--- a/tests/test_discounts.py+++ b/tests/test_discounts.py@@ -136,6 +136,7 @@ def test_specific_products_voucher_checkout_discount(def test_sale_applies_to_correct_products(product_type, category):product = Product.objects.create(name="Test Product",+ slug="test-product",price=Money(10, "USD"),description="",pk=111,@@ -145,6 +146,7 @@ def test_sale_applies_to_correct_products(product_type, category):variant = ProductVariant.objects.create(product=product, sku="firstvar")product2 = Product.objects.create(name="Second product",+ slug="second-product",price=Money(15, "USD"),description="",product_type=product_type,diff --git a/tests/test_postgresql_search.py b/tests/test_postgresql_search.pyindex 195abf41e9..ab79232a3a 100644--- a/tests/test_postgresql_search.py+++ b/tests/test_postgresql_search.py@@ -1,6 +1,7 @@from decimal import Decimalimport pytest+from django.utils.text import slugifyfrom prices import Moneyfrom saleor.account.models import Address@@ -19,6 +20,7 @@ def named_products(category, product_type):def gen_product(name, description):product = Product.objects.create(name=name,+ slug=slugify(name),description=description,price=Money(Decimal(6.6), "USD"),product_type=product_type,diff --git a/tests/test_product.py b/tests/test_product.pyindex 17e8e0b095..4337b8501a 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -27,6 +27,7 @@ def test_filtering_by_attribute(db, color_attribute, category, settings):product_type_b.variant_attributes.add(color_attribute)product_a = models.Product.objects.create(name="Test product a",+ slug="test-product-a",price=Money(10, settings.DEFAULT_CURRENCY),product_type=product_type_a,category=category,@@ -34,6 +35,7 @@ def test_filtering_by_attribute(db, color_attribute, category, settings):models.ProductVariant.objects.create(product=product_a, sku="1234")product_b = models.Product.objects.create(name="Test product b",+ slug="test-product-b",price=Money(10, settings.DEFAULT_CURRENCY),product_type=product_type_b,category=category,diff --git a/tests/test_product_minimal_variant_price.py b/tests/test_product_minimal_variant_price.pyindex 52a7c5fa42..ff08bca042 100644--- a/tests/test_product_minimal_variant_price.py+++ b/tests/test_product_minimal_variant_price.py@@ -93,6 +93,7 @@ def test_product_objects_create_sets_default_minimal_variant_price():product1 = Product.objects.create(name="Test product 1",+ slug="test-product-1",price=Money("10.00", "USD"),category=category,product_type=product_type,@@ -103,6 +104,7 @@ def test_product_objects_create_sets_default_minimal_variant_price(product2 = Product.objects.create(name="Test product 2",+ slug="test-product-2",price=Money("10.00", "USD"),minimal_variant_price=Money("20.00", "USD"),category=category,@@ -121,6 +123,7 @@ def test_product_objects_bulk_create_sets_default_minimal_variant_price([Product(name="Test product 1",+ slug="test-product-1",price=Money("10.00", "USD"),category=category,product_type=product_type,@@ -128,6 +131,7 @@ def test_product_objects_bulk_create_sets_default_minimal_variant_price(),Product(name="Test product 2",+ slug="test-product-2",price=Money("10.00", "USD"),minimal_variant_price=Money("20.00", "USD"),category=category,