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:16:31 -0400
commitd2338bae786f2fabfd01c30522fda9d79e02eb45 (patch)
treed3e8ef4c5966c07cc8c3ea83c01d32e413b68871 /tests
parent2d78b46d299da7d604a9fbf8c853d272ccd45fc2 (diff)
[1.9.x] Refs #26428 -- Added support for relative path redirects to the test client.
Thanks iktyrrell for the patch. Backport of 2f698cd9916cb3d64932248c7114049e02b74fb3 from master
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 1836dd49c5..9b9c11d9c6 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -217,6 +217,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)