Skip to content

Commit

Permalink
Fix flaky test test_order_fulfill_with_out_of_stock_webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
fowczarek committed Aug 30, 2021
1 parent 63b65c9 commit 1314cd6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions saleor/graphql/order/tests/test_fulfillment.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ def test_order_fulfill_with_out_of_stock_webhook(

query = ORDER_FULFILL_QUERY
order_id = graphene.Node.to_global_id("Order", order.id)
order_line, order_line2 = order.lines.all()
order_line_id = graphene.Node.to_global_id("OrderLine", order_line.id)
_, order_line2 = order.lines.all()
order_line2_id = graphene.Node.to_global_id("OrderLine", order_line2.id)
warehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)
variables = {
"order": order_id,
"input": {
"notifyCustomer": True,
"lines": [
{
"orderLineId": order_line_id,
"stocks": [{"quantity": 3, "warehouse": warehouse_id}],
},
{
"orderLineId": order_line2_id,
"stocks": [{"quantity": 2, "warehouse": warehouse_id}],
Expand All @@ -68,7 +63,8 @@ def test_order_fulfill_with_out_of_stock_webhook(
query, variables, permissions=[permission_manage_orders]
)

product_variant_out_of_stock_webhooks.assert_called_once_with(Stock.objects.last())
stock = order_line2.variant.stocks.filter(warehouse=warehouse).first()
product_variant_out_of_stock_webhooks.assert_called_once_with(stock)


@pytest.mark.parametrize("fulfillment_auto_approve", [True, False])
Expand Down

0 comments on commit 1314cd6

Please sign in to comment.