1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory.

This commit is contained in:
pochangl
2021-07-15 19:09:29 +08:00
committed by GitHub
parent f479df7f8d
commit f6d3557aa1
2 changed files with 11 additions and 0 deletions

View File

@@ -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')