summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-11-12 11:35:34 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-11-12 11:35:34 +0000
commitcecbed5ac97bb5b2717a50e765fb9ac22915881c (patch)
tree8ff7f2328ed3704a945bf2af4525a42f7cc0006c
parent7a1421189c9eeb9bf9377ec7cdfd698ca9748f27 (diff)
[1.0.X] Fixed #8646 -- Modified test client to set a fully WSGI compliant environment. Thanks to Adam Lofts for the report.
Merge from trunk of [9396] git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9400 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/test/client.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py
index 6a3401a2ff..ecc3a1c881 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -158,6 +158,7 @@ class Client(object):
self.defaults = defaults
self.cookies = SimpleCookie()
self.exc_info = None
+ self.errors = StringIO()
def store_exc_info(self, **kwargs):
"""
@@ -193,6 +194,12 @@ class Client(object):
'SERVER_NAME': 'testserver',
'SERVER_PORT': '80',
'SERVER_PROTOCOL': 'HTTP/1.1',
+ 'wsgi.version': (1,0),
+ 'wsgi.url_scheme': 'http',
+ 'wsgi.errors': self.errors,
+ 'wsgi.multiprocess': True,
+ 'wsgi.multithread': False,
+ 'wsgi.run_once': False,
}
environ.update(self.defaults)
environ.update(request)
@@ -254,11 +261,11 @@ class Client(object):
Requests a response from the server using GET.
"""
r = {
- 'CONTENT_LENGTH': None,
'CONTENT_TYPE': 'text/html; charset=utf-8',
'PATH_INFO': urllib.unquote(path),
'QUERY_STRING': urlencode(data, doseq=True),
'REQUEST_METHOD': 'GET',
+ 'wsgi.input': FakePayload('')
}
r.update(extra)