aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--djangorestframework/parsers.py4
-rw-r--r--djangorestframework/request.py2
-rw-r--r--djangorestframework/resource.py3
-rw-r--r--djangorestframework/tests/content.py53
4 files changed, 5 insertions, 57 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py
index 5b236647..11adeb78 100644
--- a/djangorestframework/parsers.py
+++ b/djangorestframework/parsers.py
@@ -24,10 +24,6 @@ try:
except ImportError:
from cgi import parse_qs
-class ParserMixin(object):
- parsers = ()
-
-
class BaseParser(object):
diff --git a/djangorestframework/request.py b/djangorestframework/request.py
index 988c0592..71ff8c0b 100644
--- a/djangorestframework/request.py
+++ b/djangorestframework/request.py
@@ -9,7 +9,7 @@ from django.http.multipartparser import LimitBytes
from StringIO import StringIO
class RequestMixin(object):
- """Delegate class that supplements an HttpRequest object with additional behaviour."""
+ """Mixin behaviour to deal with requests."""
USE_FORM_OVERLOADING = True
METHOD_PARAM = "_method"
diff --git a/djangorestframework/resource.py b/djangorestframework/resource.py
index 80e5df2a..6ec22073 100644
--- a/djangorestframework/resource.py
+++ b/djangorestframework/resource.py
@@ -3,7 +3,6 @@ from django.views.decorators.csrf import csrf_exempt
from djangorestframework.compat import View
from djangorestframework.emitters import EmitterMixin
-from djangorestframework.parsers import ParserMixin
from djangorestframework.authenticators import AuthenticatorMixin
from djangorestframework.validators import FormValidatorMixin
from djangorestframework.response import Response, ResponseException
@@ -19,7 +18,7 @@ from djangorestframework import emitters, parsers, authenticators, status
__all__ = ['Resource']
-class Resource(EmitterMixin, ParserMixin, AuthenticatorMixin, FormValidatorMixin, RequestMixin, View):
+class Resource(EmitterMixin, AuthenticatorMixin, FormValidatorMixin, RequestMixin, View):
"""Handles incoming requests and maps them to REST operations,
performing authentication, input deserialization, input validation, output serialization."""
diff --git a/djangorestframework/tests/content.py b/djangorestframework/tests/content.py
index 240601e0..b99f30f7 100644
--- a/djangorestframework/tests/content.py
+++ b/djangorestframework/tests/content.py
@@ -1,4 +1,6 @@
-# TODO: finish off the refactoring
+"""
+Tests for content parsing, and form-overloaded content parsing.
+"""
from django.test import TestCase
from djangorestframework.compat import RequestFactory
from djangorestframework.request import RequestMixin
@@ -9,27 +11,6 @@ class TestContentParsing(TestCase):
def setUp(self):
self.req = RequestFactory()
-# # Interface tests
-#
-# def test_content_mixin_interface(self):
-# """Ensure the ContentMixin interface is as expected."""
-# self.assertRaises(NotImplementedError, ContentMixin().determine_content, None)
-#
-# def test_standard_content_mixin_interface(self):
-# """Ensure the OverloadedContentMixin interface is as expected."""
-# self.assertTrue(issubclass(StandardContentMixin, ContentMixin))
-# getattr(StandardContentMixin, 'determine_content')
-#
-# def test_overloaded_content_mixin_interface(self):
-# """Ensure the OverloadedContentMixin interface is as expected."""
-# self.assertTrue(issubclass(OverloadedContentMixin, ContentMixin))
-# getattr(OverloadedContentMixin, 'CONTENT_PARAM')
-# getattr(OverloadedContentMixin, 'CONTENTTYPE_PARAM')
-# getattr(OverloadedContentMixin, 'determine_content')
-#
-#
-# # Common functionality to test with both StandardContentMixin and OverloadedContentMixin
-#
def ensure_determines_no_content_GET(self, view):
"""Ensure view.RAW_CONTENT returns None for GET request with no content."""
view.request = self.req.get('/')
@@ -85,28 +66,6 @@ class TestContentParsing(TestCase):
"""Ensure view.RAW_CONTENT returns content for PUT request with non-form content."""
self.ensure_determines_non_form_content_PUT(RequestMixin())
-# # OverloadedContentMixin behavioural tests
-#
-# def test_overloaded_behaviour_determines_no_content_GET(self):
-# """Ensure StandardContentMixin.determine_content(request) returns None for GET request with no content."""
-# self.ensure_determines_no_content_GET(OverloadedContentMixin())
-#
-# def test_overloaded_behaviour_determines_form_content_POST(self):
-# """Ensure StandardContentMixin.determine_content(request) returns content for POST request with content."""
-# self.ensure_determines_form_content_POST(OverloadedContentMixin())
-#
-# def test_overloaded_behaviour_determines_non_form_content_POST(self):
-# """Ensure StandardContentMixin.determine_content(request) returns (content type, content) for POST request with content."""
-# self.ensure_determines_non_form_content_POST(OverloadedContentMixin())
-#
-# def test_overloaded_behaviour_determines_form_content_PUT(self):
-# """Ensure StandardContentMixin.determine_content(request) returns content for PUT request with content."""
-# self.ensure_determines_form_content_PUT(OverloadedContentMixin())
-#
-# def test_overloaded_behaviour_determines_non_form_content_PUT(self):
-# """Ensure StandardContentMixin.determine_content(request) returns (content type, content) for PUT request with content."""
-# self.ensure_determines_non_form_content_PUT(OverloadedContentMixin())
-#
def test_overloaded_behaviour_allows_content_tunnelling(self):
"""Ensure request.RAW_CONTENT returns content for overloaded POST request"""
content = 'qwerty'
@@ -118,9 +77,3 @@ class TestContentParsing(TestCase):
view.parsers = (PlainTextParser,)
view.perform_form_overloading()
self.assertEqual(view.RAW_CONTENT, content)
-
-# def test_overloaded_behaviour_allows_content_tunnelling_content_type_not_set(self):
-# """Ensure determine_content(request) returns (None, content) for overloaded POST request with content type not set"""
-# content = 'qwerty'
-# request = self.req.post('/', {OverloadedContentMixin.CONTENT_PARAM: content})
-# self.assertEqual(OverloadedContentMixin().determine_content(request), (None, content))