summaryrefslogtreecommitdiff
path: root/tests/modeltests/test_client/models.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2008-12-08 04:53:34 +0000
committerAdrian Holovaty <adrian@holovaty.com>2008-12-08 04:53:34 +0000
commitb76d7c1decb04cdb7ec363cd589f273952ab789a (patch)
tree2fa7743da37cca1ae94cfaaa21f11d9e9c9ca935 /tests/modeltests/test_client/models.py
parente9b90d98998da48d4ac18aabe135fa4200547be5 (diff)
Added a 'permanent' argument the simple.redirect_to() generic view. It's True by default, to match existing behavior. If set to False, the redirect will be a 302 instead of a 301. This is technically backwards-incompatible if you were using the redirect_to generic view with a format-string key called 'permanent', which is highly, highly unlikely.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/test_client/models.py')
-rw-r--r--tests/modeltests/test_client/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py
index 2cca618b4e..b975d139c6 100644
--- a/tests/modeltests/test_client/models.py
+++ b/tests/modeltests/test_client/models.py
@@ -118,6 +118,12 @@ class ClientTest(TestCase):
# Check that the response was a 301 (permanent redirect) with absolute URI
self.assertRedirects(response, 'http://django.testserver/test_client/get_view/', status_code=301)
+ def test_temporary_redirect(self):
+ "GET a URL that does a non-permanent redirect"
+ response = self.client.get('/test_client/temporary_redirect_view/')
+ # Check that the response was a 302 (non-permanent redirect)
+ self.assertRedirects(response, 'http://testserver/test_client/get_view/', status_code=302)
+
def test_redirect_to_strange_location(self):
"GET a URL that redirects to a non-200 page"
response = self.client.get('/test_client/double_redirect_view/')