  
          class FileForm(forms.Form):
              file = forms.FileField()
  
          class MockView(View):
              permissions = ()
              form = FileForm
  
              def post(self, request, *args, **kwargs):
                  return Response({'FILE_NAME': self.CONTENT['file'].name,
                          'FILE_CONTENT': self.CONTENT['file'].read()})
  
 
</s> remove             def post(self, request, *args, **kwargs):
                return Response({'FILE_NAME': self.CONTENT['file'].name,
                        'FILE_CONTENT': self.CONTENT['file'].read()})
 </s> add #         class MockView(View):
#             permissions = ()
#             form = FileForm </s> remove         file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        request = self.factory.post('/', {'file': file})
        view = MockView.as_view()
        response = view(request)
        self.assertEquals(response.raw_content, {"FILE_CONTENT": "stuff", "FILE_NAME": "stuff.txt"})
 </s> add #             def post(self, request, *args, **kwargs):
#                 return Response({'FILE_NAME': self.CONTENT['file'].name,
#                         'FILE_CONTENT': self.CONTENT['file'].read()}) </s> remove         class FileForm(forms.Form):
            file = forms.FileField()
 </s> add #     def test_upload_file(self): </s> remove     def test_upload_file(self):
 </s> add # class UploadFilesTests(TestCase):
#     """Check uploading of files"""
#     def setUp(self):
#         self.factory = RequestFactory()
#         class FileForm(forms.Form):
#             file = forms.FileField()
  
          class FileForm(forms.Form):
              file = forms.FileField()
  
#         class FileForm(forms.Form):
#             file = forms.FileField()
#         class FileForm(forms.Form):
#             file = forms.FileField()
#         class FileForm(forms.Form):
#             file = forms.FileField()
  
              def post(self, request, *args, **kwargs):
                  return Response({'FILE_NAME': self.CONTENT['file'].name,
                          'FILE_CONTENT': self.CONTENT['file'].read()})
  
keep keep keep keep replace replace replace keep keep keep keep keep
 Drop out resources & mixins 
djangorestframework/tests/files.py