aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/utils.py
diff options
context:
space:
mode:
authorTom Christie2013-08-19 20:58:28 +0100
committerTom Christie2013-08-19 20:58:28 +0100
commit28e44efe25b5373f0f46357e4e26f7cb0482efa6 (patch)
tree9dd36c65ade4b801cfb7e93be7123fc5a5fb69e4 /rest_framework/tests/utils.py
parent9e4e2c60f75f596d3f9e32deaab23bf98fc8ef0f (diff)
parent34d65119fc1c200b76a8af7213a92d6b279bd478 (diff)
downloaddjango-rest-framework-28e44efe25b5373f0f46357e4e26f7cb0482efa6.tar.bz2
Merge branch 'master' into 2.4.0
Diffstat (limited to 'rest_framework/tests/utils.py')
-rw-r--r--rest_framework/tests/utils.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/rest_framework/tests/utils.py b/rest_framework/tests/utils.py
deleted file mode 100644
index 8c87917d..00000000
--- a/rest_framework/tests/utils.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from __future__ import unicode_literals
-from django.test.client import FakePayload, Client as _Client, RequestFactory as _RequestFactory
-from django.test.client import MULTIPART_CONTENT
-from rest_framework.compat import urlparse
-
-
-class RequestFactory(_RequestFactory):
-
- def __init__(self, **defaults):
- super(RequestFactory, self).__init__(**defaults)
-
- def patch(self, path, data={}, content_type=MULTIPART_CONTENT,
- **extra):
- "Construct a PATCH request."
-
- patch_data = self._encode_data(data, content_type)
-
- parsed = urlparse.urlparse(path)
- r = {
- 'CONTENT_LENGTH': len(patch_data),
- 'CONTENT_TYPE': content_type,
- 'PATH_INFO': self._get_path(parsed),
- 'QUERY_STRING': parsed[4],
- 'REQUEST_METHOD': 'PATCH',
- 'wsgi.input': FakePayload(patch_data),
- }
- r.update(extra)
- return self.request(**r)
-
-
-class Client(_Client, RequestFactory):
- def patch(self, path, data={}, content_type=MULTIPART_CONTENT,
- follow=False, **extra):
- """
- Send a resource to the server using PATCH.
- """
- response = super(Client, self).patch(path, data=data, content_type=content_type, **extra)
- if follow:
- response = self._handle_redirects(response, **extra)
- return response