|
|
@@ -55,10 +55,10 @@ class CheckoutMixin(object):
|
|
55
|
55
|
class DisabledAnonymousCheckoutViewsTests(ClientTestCase):
|
|
56
|
56
|
is_anonymous = True
|
|
57
|
57
|
|
|
58
|
|
- def test_index_does_not_require_login(self):
|
|
|
58
|
+ def test_index_does_require_login(self):
|
|
59
|
59
|
url = reverse('checkout:index')
|
|
60
|
60
|
response = self.client.get(url)
|
|
61
|
|
- self.assertIsOk(response)
|
|
|
61
|
+ self.assertIsRedirect(response)
|
|
62
|
62
|
|
|
63
|
63
|
def test_user_address_views_require_a_login(self):
|
|
64
|
64
|
urls = [reverse('checkout:user-address-create'),
|
|
|
@@ -118,7 +118,7 @@ class TestShippingAddressView(ClientTestCase, CheckoutMixin):
|
|
118
|
118
|
self.add_product_to_basket()
|
|
119
|
119
|
response = self.client.get(reverse('checkout:shipping-address'))
|
|
120
|
120
|
self.assertIsOk(response)
|
|
121
|
|
-
|
|
|
121
|
+
|
|
122
|
122
|
def test_anon_checkout_disabled_by_default(self):
|
|
123
|
123
|
self.assertFalse(settings.OSCAR_ALLOW_ANON_CHECKOUT)
|
|
124
|
124
|
|
|
|
@@ -163,13 +163,13 @@ class TestShippingMethodView(ClientTestCase, CheckoutMixin):
|
|
163
|
163
|
class TestPaymentMethodView(ClientTestCase, CheckoutMixin):
|
|
164
|
164
|
|
|
165
|
165
|
def test_view_redirects_if_no_shipping_address(self):
|
|
166
|
|
- self.add_product_to_basket()
|
|
|
166
|
+ self.add_product_to_basket()
|
|
167
|
167
|
response = self.client.get(reverse('checkout:payment-method'))
|
|
168
|
168
|
self.assertIsRedirect(response)
|
|
169
|
169
|
self.assertRedirectUrlName(response, 'checkout:shipping-address')
|
|
170
|
170
|
|
|
171
|
171
|
def test_view_redirects_if_no_shipping_method(self):
|
|
172
|
|
- self.add_product_to_basket()
|
|
|
172
|
+ self.add_product_to_basket()
|
|
173
|
173
|
self.complete_shipping_address()
|
|
174
|
174
|
response = self.client.get(reverse('checkout:payment-method'))
|
|
175
|
175
|
self.assertIsRedirect(response)
|
|
|
@@ -253,7 +253,7 @@ class TestOrderPlacement(ClientTestCase, CheckoutMixin):
|
|
253
|
253
|
self.assertIsRedirect(self.response)
|
|
254
|
254
|
orders = Order.objects.all()
|
|
255
|
255
|
self.assertEqual(1, len(orders))
|
|
256
|
|
-
|
|
|
256
|
+
|
|
257
|
257
|
|
|
258
|
258
|
class TestPlacingOrderUsingAVoucher(ClientTestCase, CheckoutMixin):
|
|
259
|
259
|
|