aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/files.py
diff options
context:
space:
mode:
authorSébastien Piquemal2012-02-02 18:19:44 +0200
committerSébastien Piquemal2012-02-02 18:19:44 +0200
commit5bb6301b7f53e3815ab1a81a5fa38721dc95b113 (patch)
tree27d53698a374ac62c4a3be41b23173775c92f207 /djangorestframework/tests/files.py
parent5f59d90645dfddc293bbbbc4ca9b4c3f3125b590 (diff)
downloaddjango-rest-framework-5bb6301b7f53e3815ab1a81a5fa38721dc95b113.tar.bz2
Response as a subclass of HttpResponse - first draft, not quite there yet.
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"})