aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/response.py
diff options
context:
space:
mode:
authorXavier Ordoquy2012-11-24 23:19:03 +0100
committerXavier Ordoquy2012-11-24 23:19:03 +0100
commit17000129e35b10c9d08497a669fd72f8233f065a (patch)
treed8edb15c1b74bfa81f6483fa15055b4ba3599b7a /rest_framework/tests/response.py
parent237e35120decb508bbad560b23ceacbcd6fccdf3 (diff)
downloaddjango-rest-framework-17000129e35b10c9d08497a669fd72f8233f065a.tar.bz2
Every (base) test should now pass with python3.
Diffstat (limited to 'rest_framework/tests/response.py')
-rw-r--r--rest_framework/tests/response.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rest_framework/tests/response.py b/rest_framework/tests/response.py
index d7b75450..237b12a9 100644
--- a/rest_framework/tests/response.py
+++ b/rest_framework/tests/response.py
@@ -1,4 +1,5 @@
import unittest
+import six
from django.conf.urls.defaults import patterns, url, include
from django.test import TestCase
@@ -25,8 +26,8 @@ class MockJsonRenderer(BaseRenderer):
DUMMYSTATUS = status.HTTP_200_OK
DUMMYCONTENT = 'dummycontent'
-RENDERER_A_SERIALIZER = lambda x: 'Renderer A: %s' % x
-RENDERER_B_SERIALIZER = lambda x: 'Renderer B: %s' % x
+RENDERER_A_SERIALIZER = lambda x: ('Renderer A: %s' % x).encode('ascii')
+RENDERER_B_SERIALIZER = lambda x: ('Renderer B: %s' % x).encode('ascii')
class RendererA(BaseRenderer):
@@ -95,7 +96,7 @@ class RendererIntegrationTests(TestCase):
resp = self.client.head('/')
self.assertEquals(resp.status_code, DUMMYSTATUS)
self.assertEquals(resp['Content-Type'], RendererA.media_type)
- self.assertEquals(resp.content, '')
+ self.assertEquals(resp.content, six.b(''))
def test_default_renderer_serializes_content_on_accept_any(self):
"""If the Accept header is set to */* the default renderer should serialize the response."""