Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix failing unit test

Damian We50fba7f9802
diff --git a/saleor/graphql/product/bulk_mutations/products.py b/saleor/graphql/product/bulk_mutations/products.py
index 78841b99a8..e35a803ad8 100644
--- a/saleor/graphql/product/bulk_mutations/products.py
+++ b/saleor/graphql/product/bulk_mutations/products.py
@@ -499,6 +499,7 @@ class ProductVariantBulkDelete(ModelBulkDeleteMutation):
@transaction.atomic
def perform_mutation(cls, _root, info, ids, **data):
_, pks = resolve_global_ids_to_primary_keys(ids, ProductVariant)
+ # get draft order lines for variants
lines_id_and_orders_id = order_models.OrderLine.objects.filter(
variant__pk__in=pks, order__status=OrderStatus.DRAFT
).values("pk", "order_id")
diff --git a/saleor/order/tests/test_order.py b/saleor/order/tests/test_order.py
index 1647b417ab..f406ae6366 100644
--- a/saleor/order/tests/test_order.py
+++ b/saleor/order/tests/test_order.py
@@ -97,7 +97,7 @@ def test_add_variant_to_draft_order_adds_line_for_new_variant(
def test_add_variant_to_draft_order_adds_line_for_new_variant_with_tax(
- order_with_lines, product, product_translation_fr, settings
+ order_with_lines, product, product_translation_fr, settings, info
):
order = order_with_lines
variant = product.variants.get()
@@ -108,7 +108,7 @@ def test_add_variant_to_draft_order_adds_line_for_new_variant_with_tax(
calculate_order_line_unit=Mock(return_value=price),
get_order_line_tax_rate=Mock(return_value=0.25),
)
- add_variant_to_draft_order(order, variant, 1, manager)
+ add_variant_to_draft_order(order, variant, 1, info.context.user, manager)
line = order.lines.last()
assert order.lines.count() == lines_before + 1