Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve code style in tests
Marcin Gębala67ac668f6aec
diff --git a/tests/api/test_order.py b/tests/api/test_order.pyindex 72a8ab3fca..916d578abe 100644--- a/tests/api/test_order.py+++ b/tests/api/test_order.py@@ -424,7 +424,6 @@ def test_can_finalize_draft_order_non_existing_variant(order_with_lines):line.refresh_from_db()assert line.variant is None- order.refresh_from_db()errors = can_finalize_draft_order(order, [])assert (errors[0].message ==diff --git a/tests/test_order.py b/tests/test_order.pyindex 57b36562eb..b2c605b15c 100644--- a/tests/test_order.py+++ b/tests/test_order.py@@ -3,24 +3,24 @@ from decimal import Decimalimport pytestfrom django.urls import reversefrom django_countries.fields import Country-from measurement.measures import Weightfrom prices import Money, TaxedMoney+from tests.utils import get_redirect_locationfrom saleor.account.models import Userfrom saleor.checkout.utils import create_orderfrom saleor.core.exceptions import InsufficientStockfrom saleor.core.utils.taxes import (DEFAULT_TAX_RATE_NAME, get_tax_rate_by_name, get_taxes_for_country)+from saleor.core.weight import zero_weightfrom saleor.order import FulfillmentStatus, OrderStatus, modelsfrom saleor.order.models import Orderfrom saleor.order.utils import (add_variant_to_order, cancel_fulfillment, cancel_order,change_order_line_quantity, delete_order_line, recalculate_order,- restock_fulfillment_lines, restock_order_lines, update_order_prices,- update_order_status)+ recalculate_order_weight, restock_fulfillment_lines, restock_order_lines,+ update_order_prices, update_order_status)from saleor.payment import ChargeStatusfrom saleor.payment.models import Payment-from tests.utils import get_redirect_locationdef test_total_setter():@@ -520,35 +520,30 @@ def test_add_order_note_view(order, authorized_client, customer_user):def _calculate_order_weight_from_lines(order):- weight = Weight(kg=0)+ weight = zero_weight()for line in order:weight += line.variant.get_weight() * line.quantityreturn weight-def test_order_weight(order_with_lines):+def test_calculate_order_weight(order_with_lines):order_weight = order_with_lines.weightcalculated_weight = _calculate_order_weight_from_lines(order_with_lines)-assert calculated_weight == order_weightdef test_order_weight_add_more_variant(order_with_lines):variant = order_with_lines.lines.first().variant-add_variant_to_order(order_with_lines, variant, 2)order_with_lines.refresh_from_db()-assert order_with_lines.weight == _calculate_order_weight_from_lines(order_with_lines)def test_order_weight_add_new_variant(order_with_lines, product):variant = product.variants.first()-add_variant_to_order(order_with_lines, variant, 2)order_with_lines.refresh_from_db()-assert order_with_lines.weight == _calculate_order_weight_from_lines(order_with_lines)@@ -558,7 +553,6 @@ def test_order_weight_change_line_quantity(order_with_lines):new_quantity = line.quantity + 2change_order_line_quantity(line, new_quantity)order_with_lines.refresh_from_db()-assert order_with_lines.weight == _calculate_order_weight_from_lines(order_with_lines)@@ -566,7 +560,6 @@ def test_order_weight_change_line_quantity(order_with_lines):def test_order_weight_delete_line(order_with_lines):line = order_with_lines.lines.first()delete_order_line(line)-assert order_with_lines.weight == _calculate_order_weight_from_lines(order_with_lines)