Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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 authored November 12, 2008

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. 9  django/test/client.py
9  django/test/client.py
@@ -158,6 +158,7 @@ def __init__(self, **defaults):
158 158
         self.defaults = defaults
159 159
         self.cookies = SimpleCookie()
160 160
         self.exc_info = None
  161
+        self.errors = StringIO()
161 162
 
162 163
     def store_exc_info(self, **kwargs):
163 164
         """
@@ -193,6 +194,12 @@ def request(self, **request):
193 194
             'SERVER_NAME':       'testserver',
194 195
             'SERVER_PORT':       '80',
195 196
             'SERVER_PROTOCOL':   'HTTP/1.1',
  197
+            'wsgi.version':      (1,0),
  198
+            'wsgi.url_scheme':   'http',
  199
+            'wsgi.errors':       self.errors,
  200
+            'wsgi.multiprocess': True,
  201
+            'wsgi.multithread':  False,
  202
+            'wsgi.run_once':     False,
196 203
         }
197 204
         environ.update(self.defaults)
198 205
         environ.update(request)
@@ -254,11 +261,11 @@ def get(self, path, data={}, **extra):
254 261
         Requests a response from the server using GET.
255 262
         """
256 263
         r = {
257  
-            'CONTENT_LENGTH':  None,
258 264
             'CONTENT_TYPE':    'text/html; charset=utf-8',
259 265
             'PATH_INFO':       urllib.unquote(path),
260 266
             'QUERY_STRING':    urlencode(data, doseq=True),
261 267
             'REQUEST_METHOD': 'GET',
  268
+            'wsgi.input':      FakePayload('')
262 269
         }
263 270
         r.update(extra)
264 271
 

0 notes on commit cecbed5

Please sign in to comment.
Something went wrong with that request. Please try again.