Skip to content

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

Add asserts to test

fowczrek826f642daadf
diff --git a/saleor/graphql/order/tests/test_fulfillment.py b/saleor/graphql/order/tests/test_fulfillment.py
index 4108c893d8..baf96914d4 100644
--- a/saleor/graphql/order/tests/test_fulfillment.py
+++ b/saleor/graphql/order/tests/test_fulfillment.py
@@ -1040,18 +1040,26 @@ query OrderFulfillData($id: ID!) {
def test_staff_can_query_order_fulfill_data(
- staff_api_client, order, permission_manage_orders
+ staff_api_client, order_with_lines, permission_manage_orders
):
- order_id = graphene.Node.to_global_id("Order", order.pk)
+ order_id = graphene.Node.to_global_id("Order", order_with_lines.pk)
variables = {"id": order_id}
response = staff_api_client.post_graphql(
QUERY_ORDER_FULFILL_DATA, variables, permissions=[permission_manage_orders]
)
- _ = get_graphql_content(response)
+ content = get_graphql_content(response)
+ data = content["data"]["order"]["lines"]
+ assert len(data) == 2
+ assert data[0]["variant"]["stocks"][0]["quantity"] == 5
+ assert data[0]["variant"]["stocks"][0]["quantityAllocated"] == 3
+ assert data[1]["variant"]["stocks"][0]["quantity"] == 2
+ assert data[1]["variant"]["stocks"][0]["quantityAllocated"] == 2
-def test_staff_can_query_order_fulfill_data_without_permission(staff_api_client, order):
- order_id = graphene.Node.to_global_id("Order", order.pk)
+def test_staff_can_query_order_fulfill_data_without_permission(
+ staff_api_client, order_with_lines
+):
+ order_id = graphene.Node.to_global_id("Order", order_with_lines.pk)
variables = {"id": order_id}
response = staff_api_client.post_graphql(QUERY_ORDER_FULFILL_DATA, variables)
assert_no_permission(response)