wsgi/test/unittest_wsgi.py
changeset 9941 8dc1c96d29f1
parent 9940 292f786009ba
child 9942 4b99196102f0
equal deleted inserted replaced
9940:292f786009ba 9941:8dc1c96d29f1
    21             'wsgi.input': StringIO('some content')})
    21             'wsgi.input': StringIO('some content')})
    22 
    22 
    23         req = CubicWebWsgiRequest(r.environ, self.vreg)
    23         req = CubicWebWsgiRequest(r.environ, self.vreg)
    24 
    24 
    25         self.assertEqual('some content', req.content.read())
    25         self.assertEqual('some content', req.content.read())
       
    26 
       
    27     def test_http_scheme(self):
       
    28         r = webtest.app.TestRequest.blank('/', {
       
    29             'wsgi.url_scheme': 'http'})
       
    30 
       
    31         req = CubicWebWsgiRequest(r.environ, self.vreg)
       
    32 
       
    33         self.assertFalse(req.https)
       
    34 
       
    35     def test_https_scheme(self):
       
    36         r = webtest.app.TestRequest.blank('/', {
       
    37             'wsgi.url_scheme': 'https'})
       
    38 
       
    39         req = CubicWebWsgiRequest(r.environ, self.vreg)
       
    40 
       
    41         self.assertTrue(req.https)
       
    42 
       
    43     def test_https_prefix(self):
       
    44         r = webtest.app.TestRequest.blank('/https/', {
       
    45             'wsgi.url_scheme': 'http'})
       
    46 
       
    47         req = CubicWebWsgiRequest(r.environ, self.vreg)
       
    48 
       
    49         self.assertTrue(req.https)
       
    50 
       
    51     @classmethod
       
    52     def init_config(cls, config):
       
    53         super(WSGIAppTC, cls).init_config(config)
       
    54         config.https_uiprops = None
       
    55         config.https_datadir_url = None