Python rest_framework.parsers.FormParser() Examples

The following are 1 code examples for showing how to use rest_framework.parsers.FormParser(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module rest_framework.parsers , or try the search function .

Example 1
Project: Deep-learning-model-deploy-with-django   Author: marcogdepinto   File: tests.py    License: 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']