summaryrefslogtreecommitdiff
path: root/tests/test_client/tests.py
diff options
context:
space:
mode:
authorJaap Roes <jroes@leukeleu.nl>2021-09-23 12:18:15 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2021-09-24 08:23:41 +0200
commit5d36af6f6fe7766c1d2d3ea8c261ed22da2861af (patch)
treede280f998dba98b6a01b05e0c95e442c1c689f62 /tests/test_client/tests.py
parent715aa2db67790926971610db232732694d5353bb (diff)
[4.0.x] Fixed #33132 -- Fixed test client handling of querystring only redirects.
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3. Backport of b1bf8c8a4ba04049dc19217bf0e876488a4fae3c from main
Diffstat (limited to 'tests/test_client/tests.py')
-rw-r--r--tests/test_client/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 3799dada91..e8ac4bfc00 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -291,6 +291,13 @@ class ClientTest(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.request['PATH_INFO'], '/accounts/login/')
+ def test_redirect_to_querystring_only(self):
+ """A URL that consists of a querystring only can be followed"""
+ response = self.client.post('/post_then_get_view/', follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.request['PATH_INFO'], '/post_then_get_view/')
+ self.assertEqual(response.content, b'The value of success is true.')
+
def test_follow_307_and_308_redirect(self):
"""
A 307 or 308 redirect preserves the request method after the redirect.