You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

catalogue_tests.py 619B

123456789101112131415161718192021
  1. import httplib
  2. from django.test import TestCase
  3. from django.test.client import Client
  4. from django.core.urlresolvers import reverse
  5. from oscar.test.helpers import create_product
  6. class SingleProductViewTest(TestCase):
  7. def setUp(self):
  8. self.client = Client()
  9. def test_canonical_urls_are_enforced(self):
  10. p = create_product()
  11. args = {'product_slug': 'wrong-slug',
  12. 'pk': p.id}
  13. wrong_url = reverse('catalogue:detail', kwargs=args)
  14. response = self.client.get(wrong_url)
  15. self.assertEquals(httplib.MOVED_PERMANENTLY, response.status_code)