  #             def post(self, request, *args, **kwargs):
  #                 return Response({'FILE_NAME': self.CONTENT['file'].name,
  #                         'FILE_CONTENT': self.CONTENT['file'].read()})
  
  #         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> remove #             def post(self, request, *args, **kwargs):
#                 return Response({'FILE_NAME': self.CONTENT['file'].name,
#                         'FILE_CONTENT': self.CONTENT['file'].read()})
 </s> add  </s> remove #         class FileForm(forms.Form):
#             file = forms.FileField()
 </s> add class UploadedFileSerializer(serializers.Serializer):
    file = serializers.FileField()
    created = serializers.DateTimeField() </s> remove # class UploadFilesTests(TestCase):
#     """Check uploading of files"""
#     def setUp(self):
#         self.factory = RequestFactory()
 </s> add class UploadedFile(object):
    def __init__(self, file, created=None):
        self.file = file
        self.created = created or datetime.datetime.now() </s> remove #     def test_upload_file(self):
 </s> add  </s> remove #         class MockView(View):
#             permissions = ()
#             form = FileForm
 </s> add     def restore_object(self, attrs, instance=None):
        if instance:
            instance.file = attrs['file']
            instance.created = attrs['created']
            return instance
        return UploadedFile(**attrs)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
  #             def post(self, request, *args, **kwargs):
  #                 return Response({'FILE_NAME': self.CONTENT['file'].name,
  #                         'FILE_CONTENT': self.CONTENT['file'].read()})
  
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
class FileSerializerTests(TestCase):

    def test_create(self):
        now = datetime.datetime.now()
        file = StringIO.StringIO('stuff')
        file.name = 'stuff.txt'
        file.size = file.len
        serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
        uploaded_file = UploadedFile(file=file, created=now)
        self.assertTrue(serializer.is_valid())
        self.assertEquals(serializer.object.created, uploaded_file.created)
        self.assertEquals(serializer.object.file, uploaded_file.file)
        self.assertFalse(serializer.object is uploaded_file)
keep keep keep keep replace replace replace replace replace replace
 Added a test for the FileField. 
rest_framework/tests/files.py