aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/test.py
diff options
context:
space:
mode:
authorTom Christie2014-03-03 14:32:38 +0000
committerTom Christie2014-03-03 14:32:38 +0000
commit24a688223240eb1e71db3c0f00cd621e80cb9fb2 (patch)
tree809035a13a8de89d020ffefea38f779bfa4a7ed3 /rest_framework/test.py
parentee9864e0dce10018261c131a76eb7c668703d76c (diff)
parent3d7cb72e0a770595d8934b731f9c462b839f941a (diff)
downloaddjango-rest-framework-24a688223240eb1e71db3c0f00cd621e80cb9fb2.tar.bz2
Merge pull request #1375 from linovia/feature/django_1_7
Django 1.7 compatibility
Diffstat (limited to 'rest_framework/test.py')
-rw-r--r--rest_framework/test.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/rest_framework/test.py b/rest_framework/test.py
index 234d10a4..75cb4d0b 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,13 @@ class APIRequestFactory(DjangoRequestFactory):
return ret, content_type
+ def get(self, path, data=None, **extra):
+ r = {
+ 'QUERY_STRING': urlencode(data or {}, doseq=True),
+ }
+ 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)