summaryrefslogtreecommitdiff
path: root/tests/modeltests/test_client/models.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-02-13 12:32:01 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-02-13 12:32:01 +0000
commitbf11ab2b212de5bfee143d6e53584434d85b32a7 (patch)
treedb75190a242656f6dd7aaca140ecd3efb1b09b9a /tests/modeltests/test_client/models.py
parent0e9f1553e1e5766559b077483ae445af11d9bb82 (diff)
[1.1.X] Fixed #12011 -- Modified the test client to preserve the request scheme on a redirect. Thanks to tgardner for the report and patch.
Backport of r12419 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12421 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/test_client/models.py')
-rw-r--r--tests/modeltests/test_client/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py
index c8f1d42725..c51323d843 100644
--- a/tests/modeltests/test_client/models.py
+++ b/tests/modeltests/test_client/models.py
@@ -138,6 +138,16 @@ class ClientTest(TestCase):
self.assertRedirects(response, 'http://testserver/test_client/get_view/', status_code=302, target_status_code=200)
self.assertEquals(len(response.redirect_chain), 2)
+ def test_redirect_http(self):
+ "GET a URL that redirects to an http URI"
+ response = self.client.get('/test_client/http_redirect_view/',follow=True)
+ self.assertFalse(response.test_was_secure_request)
+
+ def test_redirect_https(self):
+ "GET a URL that redirects to an https URI"
+ response = self.client.get('/test_client/https_redirect_view/',follow=True)
+ self.assertTrue(response.test_was_secure_request)
+
def test_notfound_response(self):
"GET a URL that responds as '404:Not Found'"
response = self.client.get('/test_client/bad_view/')