summaryrefslogtreecommitdiff
path: root/tests/test_client
diff options
context:
space:
mode:
authorpochangl <pochangl@users.noreply.github.com>2021-07-15 19:09:29 +0800
committerGitHub <noreply@github.com>2021-07-15 13:09:29 +0200
commitf6d3557aa13f33cfe2fa41094fc3d8a8b09c368c (patch)
treea5eda7385681ce9746569c219ba5633006a52728 /tests/test_client
parentf479df7f8d03ab767bb5e5d655243191087d6432 (diff)
downloaddjango-f6d3557aa13f33cfe2fa41094fc3d8a8b09c368c.tar.gz
Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory.
Diffstat (limited to 'tests/test_client')
-rw-r--r--tests/test_client/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index d9be3416f2..3799dada91 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -1010,6 +1010,10 @@ class AsyncClientTest(TestCase):
with self.assertRaisesMessage(NotImplementedError, msg):
await method('/redirect_view/', follow=True)
+ async def test_get_data(self):
+ response = await self.async_client.get('/get_view/', {'var': 'val'})
+ self.assertContains(response, 'This is a test. val is the value.')
+
@override_settings(ROOT_URLCONF='test_client.urls')
class AsyncRequestFactoryTest(SimpleTestCase):
@@ -1063,3 +1067,8 @@ class AsyncRequestFactoryTest(SimpleTestCase):
self.assertIn('HTTP_AUTHORIZATION', request.META)
self.assertEqual(request.headers['x-another-header'], 'some other value')
self.assertIn('HTTP_X_ANOTHER_HEADER', request.META)
+
+ def test_request_factory_query_string(self):
+ request = self.request_factory.get('/somewhere/', {'example': 'data'})
+ self.assertNotIn('Query-String', request.headers)
+ self.assertEqual(request.GET['example'], 'data')