Skip to content

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

Changes after the code review

Grzegorz Derdak6ad1236e28c3
diff --git a/saleor/graphql/product/tests/test_product.py b/saleor/graphql/product/tests/test_product.py
index fbfb76246a..35efb385ec 100644
--- a/saleor/graphql/product/tests/test_product.py
+++ b/saleor/graphql/product/tests/test_product.py
@@ -950,19 +950,24 @@ def test_products_query_with_filter_stocks(
assert {node["node"]["id"] for node in products_data} == product_ids
-def test_query_products_query_with_filter_ids(
- staff_api_client, product, query_products_with_filter
+def test_query_products_with_filter_ids(
+ api_client, product_list, query_products_with_filter
):
- product_global_id = graphene.Node.to_global_id("Product", product.id)
- variables = {"filter": {"ids": [product_global_id]}}
- response = staff_api_client.post_graphql(
- query_products_with_filter, variables, check_no_permissions=False
- )
+ # given
+ product_ids = [
+ graphene.Node.to_global_id("Product", product.id) for product in product_list
+ ][:2]
+ variables = {"filter": {"ids": product_ids}}
+
+ # when
+ response = api_client.post_graphql(query_products_with_filter, variables)
+
+ # then
content = get_graphql_content(response)
products_data = content["data"]["products"]["edges"]
- assert len(products_data) == 1
- assert products_data[0]["node"]["id"] == product_global_id
+ assert len(products_data) == 2
+ assert [node["node"]["id"] for node in products_data] == product_ids
def test_query_product_image_by_id(user_api_client, product_with_image):