summaryrefslogtreecommitdiff
path: root/tests/test_client/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_client/tests.py')
-rw-r--r--tests/test_client/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index 93ac3e37a7..e59f018a27 100644
--- a/tests/test_client/tests.py
+++ b/tests/test_client/tests.py
@@ -973,3 +973,18 @@ class AsyncRequestFactoryTest(SimpleTestCase):
request = method('/somewhere/')
response = await async_generic_view(request)
self.assertEqual(response.status_code, 200)
+
+ async def test_request_factory_data(self):
+ async def async_generic_view(request):
+ return HttpResponse(status=200, content=request.body)
+
+ request = self.request_factory.post(
+ '/somewhere/',
+ data={'example': 'data'},
+ content_type='application/json',
+ )
+ self.assertEqual(request.headers['content-length'], '19')
+ self.assertEqual(request.headers['content-type'], 'application/json')
+ response = await async_generic_view(request)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.content, b'{"example": "data"}')