summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-04-29 08:55:36 -0400
committerTim Graham <timograham@gmail.com>2016-04-29 09:15:28 -0400
commit2f698cd9916cb3d64932248c7114049e02b74fb3 (patch)
tree18fae8744d1aba7a0d6ee5f2e93bdf80d7ae2a29 /tests
parentffb1c532ec3f01ce625d6e54fd1d63552693c895 (diff)
Refs #26428 -- Added support for relative path redirects to the test client.
Thanks iktyrrell for the patch.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_client/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 5c3735601f..dff7e39080 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -198,6 +198,18 @@ class ClientTest(TestCase):
self.assertRedirects(response, '/get_view/', status_code=302, target_status_code=200)
self.assertEqual(len(response.redirect_chain), 2)
+ def test_follow_relative_redirect(self):
+ "A URL with a relative redirect can be followed."
+ response = self.client.get('/accounts/', follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.request['PATH_INFO'], '/accounts/login/')
+
+ def test_follow_relative_redirect_no_trailing_slash(self):
+ "A URL with a relative redirect with no trailing slash can be followed."
+ response = self.client.get('/accounts/no_trailing_slash', follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.request['PATH_INFO'], '/accounts/login/')
+
def test_redirect_http(self):
"GET a URL that redirects to an http URI"
response = self.client.get('/http_redirect_view/', follow=True)