From fe666a14ee0bcce05972671c08cdf91f3b85ebac Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 27 Sep 2012 12:50:18 +0100 Subject: [PATCH] Add test for request.POST --- rest_framework/tests/request.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rest_framework/tests/request.py b/rest_framework/tests/request.py index 805f6efc5..402f9d1bc 100644 --- a/rest_framework/tests/request.py +++ b/rest_framework/tests/request.py @@ -55,7 +55,7 @@ class TestContentParsing(TestCase): request = Request(factory.head('/')) self.assertEqual(request.DATA, None) - def test_standard_behaviour_determines_form_content_POST(self): + def test_request_DATA_with_form_content(self): """ Ensure request.DATA returns content for POST request with form content. """ @@ -64,7 +64,7 @@ class TestContentParsing(TestCase): request.parser_classes = (FormParser, MultiPartParser) self.assertEqual(request.DATA.items(), data.items()) - def test_standard_behaviour_determines_non_form_content_POST(self): + def test_request_DATA_with_text_content(self): """ Ensure request.DATA returns content for POST request with non-form content. @@ -75,6 +75,15 @@ class TestContentParsing(TestCase): request.parser_classes = (PlainTextParser,) self.assertEqual(request.DATA, content) + def test_request_POST_with_form_content(self): + """ + Ensure request.POST returns content for POST request with form content. + """ + data = {'qwerty': 'uiop'} + request = Request(factory.post('/', data)) + request.parser_classes = (FormParser, MultiPartParser) + self.assertEqual(request.POST.items(), data.items()) + def test_standard_behaviour_determines_form_content_PUT(self): """ Ensure request.DATA returns content for PUT request with form content.