aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/test.py
diff options
context:
space:
mode:
authorXavier Ordoquy2014-04-13 00:05:57 +0200
committerXavier Ordoquy2014-04-13 00:05:57 +0200
commitd08536ad9d026fb7126c430f6d9c18f8540aacd6 (patch)
treea8a1d36ce76867e57da23379694ea0609801990b /rest_framework/test.py
parent2911cd64ad67ba193e3d37322ee71692cb482623 (diff)
parent93b9245b8714287a440023451ff7880a2f6e5b32 (diff)
downloaddjango-rest-framework-d08536ad9d026fb7126c430f6d9c18f8540aacd6.tar.bz2
Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts: .travis.yml docs/api-guide/fields.md docs/api-guide/routers.md docs/topics/release-notes.md rest_framework/authentication.py rest_framework/serializers.py rest_framework/templatetags/rest_framework.py rest_framework/tests/test_authentication.py rest_framework/tests/test_filters.py rest_framework/tests/test_hyperlinkedserializers.py rest_framework/tests/test_serializer.py rest_framework/tests/test_testing.py rest_framework/utils/encoders.py tox.ini
Diffstat (limited to 'rest_framework/test.py')
-rw-r--r--rest_framework/test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/rest_framework/test.py b/rest_framework/test.py
index 234d10a4..df5a5b3b 100644
--- a/rest_framework/test.py
+++ b/rest_framework/test.py
@@ -8,6 +8,7 @@ from django.conf import settings
from django.test.client import Client as DjangoClient
from django.test.client import ClientHandler
from django.test import testcases
+from django.utils.http import urlencode
from rest_framework.settings import api_settings
from rest_framework.compat import RequestFactory as DjangoRequestFactory
from rest_framework.compat import force_bytes_or_smart_bytes, six
@@ -71,6 +72,17 @@ class APIRequestFactory(DjangoRequestFactory):
return ret, content_type
+ def get(self, path, data=None, **extra):
+ r = {
+ 'QUERY_STRING': urlencode(data or {}, doseq=True),
+ }
+ # Fix to support old behavior where you have the arguments in the url
+ # See #1461
+ if not data and '?' in path:
+ r['QUERY_STRING'] = path.split('?')[1]
+ r.update(extra)
+ return self.generic('GET', path, **r)
+
def post(self, path, data=None, format=None, content_type=None, **extra):
data, content_type = self._encode_data(data, format, content_type)
return self.generic('POST', path, data, content_type, **extra)