aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/response.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/tests/response.py')
-rw-r--r--rest_framework/tests/response.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/rest_framework/tests/response.py b/rest_framework/tests/response.py
index 875f4d42..3e1da905 100644
--- a/rest_framework/tests/response.py
+++ b/rest_framework/tests/response.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
from django.test import TestCase
from rest_framework.compat import patterns, url, include
from rest_framework.response import Response
@@ -9,6 +10,7 @@ from rest_framework.renderers import (
BrowsableAPIRenderer
)
from rest_framework.settings import api_settings
+from rest_framework.compat import six
class MockPickleRenderer(BaseRenderer):
@@ -22,8 +24,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):
@@ -92,7 +94,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."""