Ticket #12227: 12227.diff

File 12227.diff, 1.2 KB (added by Mark Lavin, 13 years ago)

Added failing test case.

  • tests/regressiontests/test_client_regress/models.py

    diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
    a b  
    363363        except AssertionError, e:
    364364            self.assertIn("abc: Response didn't redirect as expected: Response code was 200 (expected 302)", str(e))
    365365
     366    def test_temporary_redirect_chain(self):
     367        "Follow a temporary redirect."
     368        response = self.client.get('/test_client/temporary_redirect_view/', follow=True)
     369        self.assertRedirects(response, '/test_client/get_view/')
     370        self.assertEqual(len(response.redirect_chain), 1)
     371        self.assertEqual(response.redirect_chain[0], ('http://testserver/test_client/get_view/', 302))
     372
     373    @override_settings(PREPEND_WWW=True)
     374    def test_prepend_www_redirect(self):
     375        "Regression test for #12227: If PREPEND_WWW = True then the redirect is always permanent."
     376        response = self.client.get('/test_client/temporary_redirect_view/', follow=True)
     377        self.assertRedirects(response, '/test_client/get_view/')
     378
    366379
    367380class AssertFormErrorTests(TestCase):
    368381    def test_unknown_form(self):
Back to Top