Python rest_framework.parsers.FormParser() Examples

The following are 1 code examples of rest_framework.parsers.FormParser(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module rest_framework.parsers , or try the search function .
Example #1
Source File: tests.py    From Deep-learning-model-deploy-with-django with GNU General Public License v3.0 5 votes vote down vote up
def testupload(self):
        """
        Ensure request.POST returns no content for POST request with file content.
        """
        factory = APIRequestFactory()
        upload = SimpleUploadedFile("file.txt", b"file_content")
        request = Request(factory.post('App/upload', {'upload': upload}))
        request.parsers = (FormParser(), MultiPartParser())
        assert list(request.POST) == []
        assert list(request.FILES) == ['upload']