Skip to content

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

Merge branch 'master' into cleanup

jxltom08cf5f8e4b40
diff --cc CHANGELOG.md
index a8532cee1e,06f08f1b19..cee188902d
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -4,57 -4,62 +4,63 @@@ All notable, unreleased changes to thi
## [Unreleased]
- - Dropped Python 3.5 support - #4028 by @korycins
- - Refactor error handling in mutations #3891 by @maarcingebala @akjanik
- - Use only_fields instead of exclude_fields in gql api - #3940 by @michaljelonek
- - Add mutation for bulk delete order lines - #3935 by @akjanik
- - Fix dashboard 1.0 missing logo and missing back arrow on collections - #3958 by @NyanKiyoshi
- - Add mutations for publishing and unpublishing multiple pages - #3954 by @akjanik
-...
++- Cleanup code for updated function names, unused argument, etc. - #4090 by @jxltom
++
+
+ ## 2.6.0
+
+ ### API
+
+ - Add unified filtering interface in resolvers - #3952, #4078 by @korycins
+ - Add mutations for bulk actions - #3935, #3954, #3967, #3969, #3970 by @akjanik
+ - Add mutation for reordering menu items - #3958 by @NyanKiyoshi
+ - Optimize queries for single nodes - #3968 @NyanKiyoshi
+ - Refactor error handling in mutations #3891 by @maarcingebala & @akjanik
+ - Specify mutation permissions through Meta classes - #3980 by @NyanKiyoshi
+ - Unify pricing access in products and variants - #3948 by @NyanKiyoshi
+ - Use only_fields instead of exclude_fields in type definitions - #3940 by @michaljelonek
- Prefetch collections when getting sales of a bunch of products - #3961 by @NyanKiyoshi
- - Move dialog windows to querystring rather than router paths - #3953 by @dominik-zeglen
- - Add mutation for bulk cancel orders - #3967 by @akjanik
- - Hide errors in TokenVerify mutation - #3981 by @fowczarek
- - Use newest GraphQL Playground - #3971 by @salwator
- - Fix country area choices - #4008 by @fowczarek
- - Cleanup and maintenance of the GraphQL API code - #3942 by @NyanKiyoshi
- - Removed the dead `children` field from the `Menu` type - #3973 by @NyanKiyoshi
- - Add mutations for bulk publishing and unpublishing products - #3969 by akjanik
- - Add mutation for bulk publishing and unpublishing collections - #3970 by @akjanik
- - Unittests use none as media root - #3975 by @korycins
+ - Remove unnecessary dedents from GraphQL schema so new Playground can work - #4045 by @salwator
+ - Restrict resolving payment by ID - #4009 @NyanKiyoshi
+ - Require `checkoutId` for updating checkout's shipping and billing address - #4074 by @jxltom
+ - Handle errors in `TokenVerify` mutation - #3981 by @fowczarek
+ - Unify argument names in types and resolvers - #3942 by @NyanKiyoshi
+
+ ### Core
+
+ - Use Black as the default code formatting tool - #3852 by @krzysztofwolski and @NyanKiyoshi
+ - Dropped Python 3.5 support - #4028 by @korycins
- Rename Cart to Checkout - #3963 by @michaljelonek
- - Implement menus items reordering into the GraphQL API - #3958 by @NyanKiyoshi
- - Simplify permission management in API through the meta classes - #3980 by @NyanKiyoshi
- - Add settings to enable Django Debug Toolbar - #3983 by @koradon
- - Implement variant availability, introducing discounts in variants - #3948 by @NyanKiyoshi
+ - Use data classes to exchange data with payment gateways - #4028 by @korycins
+ - Refactor order events - #4018 by @NyanKiyoshi
+
+ ### Dashboard 2.0
+
- Add bulk actions - #3955 by @dominik-zeglen
- - Update file field styles with materializecss template filter - #3998 by @zodiacfireworks
- - Add filtering interface for graphQL API - #3952 by @korycins
- - Restrict single payment resolving - #4009 @NyanKiyoshi
- - Add mandatory fields errors in new product form - #4024 by @benekex2
- - Add navigation drawer support - #3839 by @benekex2
- - Set up explicit __hash__ function - #3979 by @akjanik
- - Update node-sass to latest version to fix node-js 12 compatibility - #4033 @NyanKiyoshi
- - Ensure adding to quantities in checkout is respecting the limits set both in storefront 1.0 and in the API - #4005 by @NyanKiyoshi
- - Fix price_range_as_dict function - #3999 by @zodiacfireworks
- - Remove unused decorator - #4036 by @maarcingebala
- - Overall improvement of the GraphQL performances, especially on single nodes - #3968 @NyanKiyoshi
- - Remove unnecessary dedents from GraphQL schema so new Playground can work - #4045 by @salwator
- Add user avatar management - #4030 by @benekex2
- - Use dataclasses as a structure for payment's gateways - #4028 by @korycins
+ - Add navigation drawer support on mobile devices - #3839 by @benekex2
+ - Fix rendering validation errors in product form - #4024 by @benekex2
+ - Move dialog windows to query string rather than router paths - #3953 by @dominik-zeglen
+ - Update order events types - #4089 by @jxltom
+ - Code cleanup by replacing render props with react hooks - #4010 by @dominik-zeglen
+
+ ### Other notable changes
+
+ - Add setting to enable Django Debug Toolbar - #3983 by @koradon
+ - Use newest GraphQL Playground - #3971 by @salwator
+ - Ensure adding to quantities in the checkout is respecting the limits - #4005 by @NyanKiyoshi
+ - Fix country area choices - #4008 by @fowczarek
+ - Fix price_range_as_dict function - #3999 by @zodiacfireworks
- Fix the product listing not showing in the voucher when there were products selected - #4062 by @NyanKiyoshi
- Fix crash in Dashboard 1.0 when updating an order address's phone number - #4061 by @NyanKiyoshi
- - Update test function names since ready_to_place_order is renamed to clean_checkout- #4070 by @jxltom
- - Resort imports and remove unused imports - #4069 by @jxltom
- - Fix typo in CheckoutBillingAddressUpdate - #4073 by @jxltom
- - Required checkout ID for updating checkout's shipping and billing address - #4074 by @jxltom
- - Implement order events - #4018 by @NyanKiyosho
- - Implemented new events: `DRAFT_CREATED`, `DRAFT_ADDED_PRODUCTS`, `DRAFT_REMOVED_PRODUCTS`, and `PAYMENT_FAILED`;
- - Implemented new mail events: `TRACKING_UPDATED`, `DIGITAL_LINKS`;
- - Refactored logic of events, it's now easier than ever to add and send events.
- Reduce the time of tests execution by using dummy password hasher - #4083 by @korycins
- - Add migrations since unnecessary indexes are removed in mptt model in [django-mptt/django-mptt#578](https://github.com/django-mptt/django-mptt/pull/578) - #4071 by @jxltom
- - Cleanup code for updated function names, unused argument, etc. - #4090 by @jxltom
-
+ - Set up explicit **hash** function - #3979 by @akjanik
+ - Unit tests use none as media root - #3975 by @korycins
+ - Update file field styles with materializecss template filter - #3998 by @zodiacfireworks
+ - New translations:
+ - Albanian
+ - Colombian Spanish
+ - Lithuanian
## 2.5.0
diff --cc saleor/graphql/menu/mutations.py
index 1c960e85ff,5cdad503f2..71ecf43ebd
--- a/saleor/graphql/menu/mutations.py
+++ b/saleor/graphql/menu/mutations.py
@@@ -274,9 -272,9 +272,9 @@@ class MenuItemMove(BaseMutation)
menu_item.save()
@classmethod
- def perform_mutation(cls, root, info, menu, moves):
+ def perform_mutation(cls, _root, info, menu, moves):
_type, menu_id = from_global_id(menu) # type: str, int
- assert _type == 'Menu', 'Expected a menu of type Menu'
+ assert _type == "Menu", "Expected a menu of type Menu"
operations = cls.clean_moves(info, menu_id, moves)
diff --cc tests/api/test_base_mutation.py
index 2888726396,dad9439e12..5ab6785c7b
--- a/tests/api/test_base_mutation.py
+++ b/tests/api/test_base_mutation.py
@@@ -15,13 -15,13 +15,13 @@@ class Mutation(BaseMutation)
product_id = graphene.ID(required=True)
class Meta:
- description = 'Base mutation'
+ description = "Base mutation"
@classmethod
- def perform_mutation(cls, root, info, product_id):
+ def perform_mutation(cls, _root, info, product_id):
product = cls.get_node_or_error(
- info, product_id, field='product_id',
- only_type=product_types.Product)
+ info, product_id, field="product_id", only_type=product_types.Product
+ )
return Mutation(name=product.name)
diff --cc tests/api/test_order.py
index 208b2b3f01,e63b431409..1f10e411a6
--- a/tests/api/test_order.py
+++ b/tests/api/test_order.py
@@@ -589,41 -610,41 +610,41 @@@ def test_can_finalize_order
def test_can_finalize_order_no_order_lines(
- staff_api_client, permission_manage_orders, order):
- order_id = graphene.Node.to_global_id('Order', order.id)
- variables = {'id': order_id}
+ staff_api_client, permission_manage_orders, order
+ ):
+ order_id = graphene.Node.to_global_id("Order", order.id)
+ variables = {"id": order_id}
staff_api_client.user.user_permissions.add(permission_manage_orders)
- response = staff_api_client.post_graphql(
- ORDER_CAN_FINALIZE_QUERY, variables)
+ response = staff_api_client.post_graphql(ORDER_CAN_FINALIZE_QUERY, variables)
content = get_graphql_content(response)
- assert content['data']['order']['canFinalize'] is False
+ assert content["data"]["order"]["canFinalize"] is False
-def test_can_finalize_draft_order(order_with_lines):
+def test_validate_draft_order(order_with_lines):
# should not raise any errors
validate_draft_order(order_with_lines)
-def test_can_finalize_draft_order_wrong_shipping(order_with_lines):
+def test_validate_draft_order_wrong_shipping(order_with_lines):
order = order_with_lines
shipping_zone = order.shipping_method.shipping_zone
- shipping_zone.countries = ['DE']
+ shipping_zone.countries = ["DE"]
shipping_zone.save()
assert order.shipping_address.country.code not in shipping_zone.countries
with pytest.raises(ValidationError) as e:
validate_draft_order(order)
- msg = 'Shipping method is not valid for chosen shipping address'
- assert e.value.error_dict['shipping'][0].message == msg
+ msg = "Shipping method is not valid for chosen shipping address"
+ assert e.value.error_dict["shipping"][0].message == msg
-def test_can_finalize_draft_order_no_order_lines(order):
+def test_validate_draft_order_no_order_lines(order):
with pytest.raises(ValidationError) as e:
validate_draft_order(order)
- msg = 'Could not create order without any products.'
- assert e.value.error_dict['lines'][0].message == msg
+ msg = "Could not create order without any products."
+ assert e.value.error_dict["lines"][0].message == msg
-def test_can_finalize_draft_order_non_existing_variant(order_with_lines):
+def test_validate_draft_order_non_existing_variant(order_with_lines):
order = order_with_lines
line = order.lines.first()
variant = line.variant
diff --cc tests/test_cart.py
index 654628f60b,c97579bf39..6feb5cdbe9
--- a/tests/test_cart.py
+++ b/tests/test_cart.py
@@@ -613,29 -661,35 +661,35 @@@ def test_update_view_must_be_ajax(custo
assert result.status_code == 302
-def test_get_checkout_data(request_checkout_with_item, shipping_zone, vatlayer):
+def test_get_checkout_context(request_checkout_with_item, shipping_zone, vatlayer):
checkout = request_checkout_with_item
shipment_option = get_shipping_price_estimate(
- checkout.get_subtotal().gross, checkout.get_total_weight(), 'PL', vatlayer)
+ checkout.get_subtotal().gross, checkout.get_total_weight(), "PL", vatlayer
+ )
checkout_data = utils.get_checkout_context(
- checkout, None, vatlayer, currency='USD', shipping_range=shipment_option)
- assert checkout_data['checkout_total'] == TaxedMoney(
- net=Money('8.13', 'USD'), gross=Money(10, 'USD'))
- assert checkout_data['total_with_shipping'].start == TaxedMoney(
- net=Money('16.26', 'USD'), gross=Money(20, 'USD'))
+ checkout, None, vatlayer, currency="USD", shipping_range=shipment_option
+ )
+ assert checkout_data["checkout_total"] == TaxedMoney(
+ net=Money("8.13", "USD"), gross=Money(10, "USD")
+ )
+ assert checkout_data["total_with_shipping"].start == TaxedMoney(
+ net=Money("16.26", "USD"), gross=Money(20, "USD")
+ )
-def test_get_checkout_data_no_shipping(request_checkout_with_item, vatlayer):
+def test_get_checkout_context_no_shipping(request_checkout_with_item, vatlayer):
checkout = request_checkout_with_item
shipment_option = get_shipping_price_estimate(
- checkout.get_subtotal().gross, checkout.get_total_weight(), 'PL', vatlayer)
+ checkout.get_subtotal().gross, checkout.get_total_weight(), "PL", vatlayer
+ )
checkout_data = utils.get_checkout_context(
- checkout, None, vatlayer,
- currency='USD', shipping_range=shipment_option)
- checkout_total = checkout_data['checkout_total']
+ checkout, None, vatlayer, currency="USD", shipping_range=shipment_option
+ )
+ checkout_total = checkout_data["checkout_total"]
assert checkout_total == TaxedMoney(
- net=Money('8.13', 'USD'), gross=Money(10, 'USD'))
- assert checkout_data['total_with_shipping'].start == checkout_total
+ net=Money("8.13", "USD"), gross=Money(10, "USD")
+ )
+ assert checkout_data["total_with_shipping"].start == checkout_total
def test_checkout_total_with_discount(request_checkout_with_item, sale, vatlayer):