|
|
@@ -1,5 +1,3 @@
|
|
1
|
|
-from http import client as http_client
|
|
2
|
|
-
|
|
3
|
1
|
from django.urls import reverse
|
|
4
|
2
|
|
|
5
|
3
|
from oscar.core.loading import get_class, get_model
|
|
|
@@ -201,10 +199,11 @@ class TestPlacingAnOrderUsingAnOffer(CheckoutMixin, WebTestCase):
|
|
201
|
199
|
|
|
202
|
200
|
class TestThankYouView(CheckoutMixin, WebTestCase):
|
|
203
|
201
|
|
|
204
|
|
- def tests_gets_a_404_when_there_is_no_order(self):
|
|
|
202
|
+ def tests_gets_a_302_when_there_is_no_order(self):
|
|
205
|
203
|
response = self.get(
|
|
206
|
204
|
reverse('checkout:thank-you'), user=self.user, status="*")
|
|
207
|
|
- self.assertEqual(http_client.NOT_FOUND, response.status_code)
|
|
|
205
|
+ self.assertIsRedirect(response)
|
|
|
206
|
+ self.assertRedirectsTo(response, 'catalogue:index')
|
|
208
|
207
|
|
|
209
|
208
|
def tests_custumers_can_reach_the_thank_you_page(self):
|
|
210
|
209
|
self.add_product_to_basket()
|
|
|
@@ -230,7 +229,7 @@ class TestThankYouView(CheckoutMixin, WebTestCase):
|
|
230
|
229
|
response = self.get(test_url, status='*', user=user)
|
|
231
|
230
|
self.assertIsOk(response)
|
|
232
|
231
|
|
|
233
|
|
- def test_users_cannot_force_an_other_custumer_order(self):
|
|
|
232
|
+ def test_users_cannot_force_an_other_customer_order(self):
|
|
234
|
233
|
self.add_product_to_basket()
|
|
235
|
234
|
self.enter_shipping_address()
|
|
236
|
235
|
self.place_order()
|
|
|
@@ -241,8 +240,10 @@ class TestThankYouView(CheckoutMixin, WebTestCase):
|
|
241
|
240
|
test_url = '%s?order_number=%s' % (
|
|
242
|
241
|
reverse('checkout:thank-you'), order.number)
|
|
243
|
242
|
response = self.get(test_url, status='*', user=user)
|
|
244
|
|
- self.assertEqual(response.status_code, http_client.NOT_FOUND)
|
|
|
243
|
+ self.assertIsRedirect(response)
|
|
|
244
|
+ self.assertRedirectsTo(response, 'catalogue:index')
|
|
245
|
245
|
|
|
246
|
246
|
test_url = '%s?order_id=%s' % (reverse('checkout:thank-you'), order.pk)
|
|
247
|
247
|
response = self.get(test_url, status='*', user=user)
|
|
248
|
|
- self.assertEqual(response.status_code, http_client.NOT_FOUND)
|
|
|
248
|
+ self.assertIsRedirect(response)
|
|
|
249
|
+ self.assertRedirectsTo(response, 'catalogue:index')
|