Skip to content

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

Add another test case for checkout

Artur Smętc6aee126a9ab
diff --git a/saleor/checkout/test_checkout.py b/saleor/checkout/test_checkout.py
index 1c683b5a1d..3cb4b4c622 100644
--- a/saleor/checkout/test_checkout.py
+++ b/saleor/checkout/test_checkout.py
@@ -96,7 +96,8 @@ def test_shipping_step_save_with_address_in_checkout(rf):
def test_shipping_step_save_with_address_other_than_billing(rf):
- address_data = {'first_name': 'Billing Company LTD',
+ address_data = {
+ 'first_name': 'Billing Company LTD',
'last_name': 'Test',
'street_address_1': 'Test',
'street_address_2': 'Test',
@@ -118,11 +119,42 @@ def test_shipping_step_save_with_address_other_than_billing(rf):
group.address = None
storage = {
'address': {
- 'first_name': 'Change',
- 'last_name': 'Me',
+ 'first_name': 'Billing Address',
+ 'last_name': 'Test',
'id': 10}}
billing_address = Address(**address_data)
step = ShippingStep(request, storage, group, billing_address)
assert step.forms_are_valid()
step.save()
assert storage['address'] == address_data
+
+
+def test_shipping_step_save_same_as_billing(rf):
+ address_data = {
+ 'first_name': 'Billing Company LTD',
+ 'last_name': 'Test',
+ 'street_address_1': 'Test',
+ 'street_address_2': 'Test',
+ 'city': 'Test',
+ 'phone': '12345678',
+ 'postal_code': '987654',
+ 'country': 'PL',
+ 'country_area': '',
+ 'company_name': 'Test'}
+ data = dict(
+ address_data,
+ method='dummy_shipping',
+ shipping_same_as_billing=True)
+
+ request = rf.post('/checkout/', data)
+ request.user = AnonymousUser()
+ request.session = {}
+ group = MagicMock()
+ group.address = None
+ storage = {
+ 'address': NEW_ADDRESS}
+ step = ShippingStep(request, storage, group,
+ billing_address=Address(**NEW_ADDRESS))
+ assert step.forms_are_valid()
+ step.save()
+ assert storage['address'] == NEW_ADDRESS