Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.0.X] Fixed #8646 -- Modified test client to set a fully WSGI compl…

…iant 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
  • Loading branch information...
commit cecbed5ac97bb5b2717a50e765fb9ac22915881c 1 parent 7a14211
Russell Keith-Magee freakboy3742 authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 django/test/client.py
9 django/test/client.py
View
@@ -158,6 +158,7 @@ def __init__(self, **defaults):
self.defaults = defaults
self.cookies = SimpleCookie()
self.exc_info = None
+ self.errors = StringIO()
def store_exc_info(self, **kwargs):
"""
@@ -193,6 +194,12 @@ def request(self, **request):
'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 @@ def get(self, path, data={}, **extra):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.