Fix Django master support.

- Explicitly encode PUT data as multipart, as Django 1.5 no longer does so by default in the test client
This commit is contained in:
Mjumbe Wawatu Poe 2012-09-07 18:44:57 -04:00
parent 7d9125bcb6
commit f729d0eb0b

View File

@ -4,6 +4,7 @@ Tests for content parsing, and form-overloaded content parsing.
from django.conf.urls.defaults import patterns
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.test.client import MULTIPART_CONTENT, BOUNDARY, encode_multipart
from djangorestframework import status
from djangorestframework.authentication import SessionAuthentication
@ -94,7 +95,8 @@ class TestContentParsing(TestCase):
"""
data = {'qwerty': 'uiop'}
parsers = (FormParser, MultiPartParser)
request = factory.put('/', data, parsers=parsers)
request = factory.put('/', encode_multipart(BOUNDARY, data), parsers=parsers,
content_type=MULTIPART_CONTENT)
self.assertEqual(request.DATA.items(), data.items())
def test_standard_behaviour_determines_non_form_content_PUT(self):