Changes between Initial Version and Version 1 of Ticket #32164


Ignore:
Timestamp:
Nov 2, 2020, 11:47:40 AM (4 years ago)
Author:
patrick
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32164 – Description

    initial v1  
    3030Code is here: https://github.com/django/django/blob/d1791539a7d86739cd44c909fa8239cae7f85874/django/test/client.py#L543
    3131
     32Code the reproduce is this:
     33
     34{{{
     35class AsyncRequestFactoryTestPassingData(SimpleTestCase):
     36    request_factory = AsyncRequestFactory()
     37
     38    async def test_request_factory(self):
     39        async def async_generic_view(request):
     40            return HttpResponse(status=200, content=request.body)
     41
     42        request = self.request_factory.post('/somewhere/', data={'example': 'data'},  content_type="application/json")
     43        response = await async_generic_view(request)
     44        self.assertEqual(response.status_code, 200)
     45        self.assertEqual(response.content, b'{"example": "data"}')
     46}}}
     47
     48
    3249Also I did a patch for this which seems to work: https://github.com/django/django/pull/13632
    3350
Back to Top