Django

Code

Changeset 9396

Show
Ignore:
Timestamp:
11/12/08 05:19:37 (2 months ago)
Author:
russellm
Message:

Fixed #8646 -- Modified test client to set a fully WSGI compliant environment. Thanks to Adam Lofts for the report.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/test/client.py

    r9188 r9396  
    159159        self.cookies = SimpleCookie() 
    160160        self.exc_info = None 
     161        self.errors = StringIO() 
    161162 
    162163    def store_exc_info(self, **kwargs): 
     
    194195            'SERVER_PORT':       '80', 
    195196            '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, 
    196203        } 
    197204        environ.update(self.defaults) 
     
    255262        """ 
    256263        r = { 
    257             'CONTENT_LENGTH':  None, 
    258264            'CONTENT_TYPE':    'text/html; charset=utf-8', 
    259265            'PATH_INFO':       urllib.unquote(path), 
    260266            'QUERY_STRING':    urlencode(data, doseq=True), 
    261267            'REQUEST_METHOD': 'GET', 
     268            'wsgi.input':      FakePayload('') 
    262269        } 
    263270        r.update(extra) 
     
    290297        """ 
    291298        r = { 
    292             'CONTENT_LENGTH':  None, 
    293299            'CONTENT_TYPE':    'text/html; charset=utf-8', 
    294300            'PATH_INFO':       urllib.unquote(path), 
    295301            'QUERY_STRING':    urlencode(data, doseq=True), 
    296302            'REQUEST_METHOD': 'HEAD', 
     303            'wsgi.input':      FakePayload('') 
    297304        } 
    298305        r.update(extra) 
     
    305312        """ 
    306313        r = { 
    307             'CONTENT_LENGTH':  None, 
    308             'CONTENT_TYPE':    None, 
    309314            'PATH_INFO':       urllib.unquote(path), 
    310315            'QUERY_STRING':    urlencode(data, doseq=True), 
    311316            'REQUEST_METHOD': 'OPTIONS', 
     317            'wsgi.input':      FakePayload('') 
    312318        } 
    313319        r.update(extra) 
     
    339345        """ 
    340346        r = { 
    341             'CONTENT_LENGTH':  None, 
    342             'CONTENT_TYPE':    None, 
    343347            'PATH_INFO':       urllib.unquote(path), 
    344348            'REQUEST_METHOD': 'DELETE', 
    345             } 
     349            'wsgi.input':      FakePayload('') 
     350        } 
    346351        r.update(extra) 
    347352