Skip to content

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

Merge branch 'master' into remove-deprecated-code

IKarbowiakce15c4c68c1c
diff --cc CHANGELOG.md
index 9471e11a81,8ebb0b2220..5e4b0525ae
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -35,7 -35,8 +35,9 @@@ All notable, unreleased changes to thi
- Replace permissions strings with enums - #5038 by @kswiatek92
- Remove gateways forms and templates - #5075 by @IKarbowiak
- Add `Wishlist` models and GraphQL endpoints - #5021 by @derenio
+- Remove deprecated code - #5107 by @IKarbowiak
+ - Fix voucher start date filtering - #5133 by @dominik-zeglen
+ - Search by sku in products query - #5117 by @fowczarek
## 2.9.0
diff --cc tests/api/test_product.py
index d63682488f,0f69c568c8..9142546e6b
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@@ -430,6 -449,65 +447,29 @@@ def test_products_query_with_filter
assert products[0]["node"]["name"] == second_product.name
+ @pytest.mark.parametrize("is_published", [(True), (False)])
+ def test_products_query_with_filter_search_by_sku(
+ is_published,
+ query_products_with_filter,
+ staff_api_client,
+ product_with_two_variants,
+ product_with_default_variant,
+ permission_manage_products,
+ ):
+ product_with_default_variant.is_published = is_published
+ product_with_default_variant.save(update_fields=["is_published"])
+ variables = {"filter": {"search": "1234"}}
+ staff_api_client.user.user_permissions.add(permission_manage_products)
+ response = staff_api_client.post_graphql(query_products_with_filter, variables)
+ content = get_graphql_content(response)
+ product_id = graphene.Node.to_global_id("Product", product_with_default_variant.id)
+ products = content["data"]["products"]["edges"]
+
+ assert len(products) == 1
+ assert products[0]["node"]["id"] == product_id
+ assert products[0]["node"]["name"] == product_with_default_variant.name
+
+
-def test_product_query_search(user_api_client, product_type, category):
- blue_product = Product.objects.create(
- name="Blue Paint",
- price=Money("10.00", "USD"),
- product_type=product_type,
- category=category,
- is_published=True,
- )
- Product.objects.create(
- name="Red Paint",
- price=Money("10.00", "USD"),
- product_type=product_type,
- category=category,
- is_published=True,
- )
-
- query = """
- query productSearch($query: String) {
- products(query: $query, first: 10) {
- edges {
- node {
- name
- }
- }
- }
- }
- """
-
- response = user_api_client.post_graphql(query, {"query": "blu p4int"})
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
-
- assert len(products) == 1
- assert products[0]["node"]["name"] == blue_product.name
-
-
def test_query_product_image_by_id(user_api_client, product_with_image):
image = product_with_image.images.first()
query = """