aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/request.py
diff options
context:
space:
mode:
authorTom Christie2013-02-04 20:37:09 +0000
committerTom Christie2013-02-04 20:37:09 +0000
commit8e846bdf52f03d0733ac73e418152800e582b898 (patch)
treecd7034d5573f1e264798a618c88addc4d2f45ce0 /rest_framework/tests/request.py
parentd9b73e15c87c3a7f11d6bea5ffd6118f86e40051 (diff)
parent97f2b994951605ffdef08159be450d1e77762bf9 (diff)
downloaddjango-rest-framework-8e846bdf52f03d0733ac73e418152800e582b898.tar.bz2
Merge branch 'py3k' into 2.2
Conflicts: rest_framework/relations.py rest_framework/serializers.py rest_framework/tests/relations_hyperlink.py rest_framework/tests/relations_slug.py
Diffstat (limited to 'rest_framework/tests/request.py')
-rw-r--r--rest_framework/tests/request.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/rest_framework/tests/request.py b/rest_framework/tests/request.py
index 4b032405..92b1bfd8 100644
--- a/rest_framework/tests/request.py
+++ b/rest_framework/tests/request.py
@@ -20,6 +20,7 @@ from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.views import APIView
+from rest_framework.compat import six
factory = RequestFactory()
@@ -79,14 +80,14 @@ class TestContentParsing(TestCase):
data = {'qwerty': 'uiop'}
request = Request(factory.post('/', data))
request.parsers = (FormParser(), MultiPartParser())
- self.assertEqual(request.DATA.items(), data.items())
+ self.assertEqual(list(request.DATA.items()), list(data.items()))
def test_request_DATA_with_text_content(self):
"""
Ensure request.DATA returns content for POST request with
non-form content.
"""
- content = 'qwerty'
+ content = six.b('qwerty')
content_type = 'text/plain'
request = Request(factory.post('/', content, content_type=content_type))
request.parsers = (PlainTextParser(),)
@@ -99,7 +100,7 @@ class TestContentParsing(TestCase):
data = {'qwerty': 'uiop'}
request = Request(factory.post('/', data))
request.parsers = (FormParser(), MultiPartParser())
- self.assertEqual(request.POST.items(), data.items())
+ self.assertEqual(list(request.POST.items()), list(data.items()))
def test_standard_behaviour_determines_form_content_PUT(self):
"""
@@ -117,14 +118,14 @@ class TestContentParsing(TestCase):
request = Request(factory.put('/', data))
request.parsers = (FormParser(), MultiPartParser())
- self.assertEqual(request.DATA.items(), data.items())
+ self.assertEqual(list(request.DATA.items()), list(data.items()))
def test_standard_behaviour_determines_non_form_content_PUT(self):
"""
Ensure request.DATA returns content for PUT request with
non-form content.
"""
- content = 'qwerty'
+ content = six.b('qwerty')
content_type = 'text/plain'
request = Request(factory.put('/', content, content_type=content_type))
request.parsers = (PlainTextParser(), )