aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/files.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/tests/files.py')
-rw-r--r--djangorestframework/tests/files.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/djangorestframework/tests/files.py b/djangorestframework/tests/files.py
index d3b1cc56..bbdff70b 100644
--- a/djangorestframework/tests/files.py
+++ b/djangorestframework/tests/files.py
@@ -1,8 +1,11 @@
from django.test import TestCase
from django import forms
+
from djangorestframework.compat import RequestFactory
from djangorestframework.views import View
from djangorestframework.resources import FormResource
+from djangorestframework.response import Response
+
import StringIO
class UploadFilesTests(TestCase):
@@ -20,13 +23,13 @@ class UploadFilesTests(TestCase):
form = FileForm
def post(self, request, *args, **kwargs):
- return {'FILE_NAME': self.CONTENT['file'].name,
- 'FILE_CONTENT': self.CONTENT['file'].read()}
+ 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.content, '{"FILE_CONTENT": "stuff", "FILE_NAME": "stuff.txt"}')
+ self.assertEquals(response.raw_content, {"FILE_CONTENT": "stuff", "FILE_NAME": "stuff.txt"})