Test RequestFactory with empty body

This commit is contained in:
Ryan P Kilby 2017-08-22 15:02:18 -04:00
parent fed85bc29d
commit eb88687e28

View File

@ -274,3 +274,12 @@ class TestAPIRequestFactory(TestCase):
assert dict(request.GET) == {'demo': ['testé']}
request = factory.get('/view/', {'demo': 'testé'})
assert dict(request.GET) == {'demo': ['testé']}
def test_empty_request_content_type(self):
factory = APIRequestFactory()
request = factory.post(
'/post-view/',
data=None,
content_type='application/json',
)
assert request.content_type == 'application/json'