aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/utils.py
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-02-19 10:26:27 +0000
committertom christie tom@tomchristie.com2011-02-19 10:26:27 +0000
commit805aa03ec1871f6a766d9052b348ddce9e9843c3 (patch)
tree8ab5b6a7396236aa45bbc61e8404cc77fc75a9c5 /djangorestframework/tests/utils.py
parentb749b950a1b4bede76b7e3900a6385779904902d (diff)
downloaddjango-rest-framework-805aa03ec1871f6a766d9052b348ddce9e9843c3.tar.bz2
Yowzers. Final big bunch of refactoring for 0.1 release. Now support Django 1.3's views, admin style api is all polished off, loads of tests, new test project for running the test. All sorts of goodness. Getting ready to push this out now.
Diffstat (limited to 'djangorestframework/tests/utils.py')
-rw-r--r--djangorestframework/tests/utils.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/djangorestframework/tests/utils.py b/djangorestframework/tests/utils.py
deleted file mode 100644
index ef0cb59c..00000000
--- a/djangorestframework/tests/utils.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from django.test import Client
-from django.core.handlers.wsgi import WSGIRequest
-
-# From: http://djangosnippets.org/snippets/963/
-# Lovely stuff
-class RequestFactory(Client):
- """
- Class that lets you create mock Request objects for use in testing.
-
- Usage:
-
- rf = RequestFactory()
- get_request = rf.get('/hello/')
- post_request = rf.post('/submit/', {'foo': 'bar'})
-
- This class re-uses the django.test.client.Client interface, docs here:
- http://www.djangoproject.com/documentation/testing/#the-test-client
-
- Once you have a request object you can pass it to any view function,
- just as if that view had been hooked up using a URLconf.
-
- """
- def request(self, **request):
- """
- Similar to parent class, but returns the request object as soon as it
- has created it.
- """
- environ = {
- 'HTTP_COOKIE': self.cookies,
- 'PATH_INFO': '/',
- 'QUERY_STRING': '',
- 'REQUEST_METHOD': 'GET',
- 'SCRIPT_NAME': '',
- 'SERVER_NAME': 'testserver',
- 'SERVER_PORT': 80,
- 'SERVER_PROTOCOL': 'HTTP/1.1',
- }
- environ.update(self.defaults)
- environ.update(request)
- return WSGIRequest(environ)