Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1326

Show
Ignore:
Timestamp:
09/03/06 16:46:36
Author:
fumanchu
Message:

mod_python improvements:

  1. Fix to test_config.
  2. Skipped some additional tests for known bugs.
  3. Documented that mod_python doesn't allow chunked encoding in request.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/test/modpy.py

    r1319 r1326  
    16161. Apache processes Range headers automatically; CherryPy's truncated 
    1717    output is then truncated again by Apache. See test_core.testRanges. 
     18    This was worked around in http://www.cherrypy.org/changeset/1319. 
    18192. Apache does not allow custom HTTP methods like CONNECT as per the spec. 
    1920    See test_core.testHTTPMethods. 
     
    25266. Apache (or perhaps modpython, or modpython_gateway) unquotes %xx in the 
    2627    Request-URI too early. 
     287. mod_python will not read request bodies which use the "chunked" 
     29    transfer-coding (it passes REQUEST_CHUNKED_ERROR to ap_setup_client_block 
     30    instead of REQUEST_CHUNKED_DECHUNK, see Apache2's http_protocol.c and 
     31    mod_python's requestobject.c). 
    2732""" 
    2833 
     
    127132        from cherrypy.test import webtest 
    128133        webtest.WebCase.PORT = self.port 
     134        webtest.WebCase.harness = self 
    129135        print 
    130136        print "Running tests:", self.server 
  • trunk/cherrypy/test/test.py

    r1310 r1326  
    6060        from cherrypy.test import helper 
    6161        webtest.WebCase.PORT = self.port 
     62        webtest.WebCase.harness = self 
    6263        print 
    6364        print "Running tests:", self.server 
     
    266267        if self.server == 'cpmodpy': 
    267268            from cherrypy.test import modpy 
    268             m = modpy.ModPythonTestHarness(self.tests, self.server, 
     269            h = modpy.ModPythonTestHarness(self.tests, self.server, 
    269270                                           self.protocol, self.port) 
    270             m.use_wsgi = False 
    271             m.run(conf) 
     271            h.use_wsgi = False 
    272272        elif self.server == 'modpygw': 
    273273            from cherrypy.test import modpy 
    274             m = modpy.ModPythonTestHarness(self.tests, self.server, 
     274            h = modpy.ModPythonTestHarness(self.tests, self.server, 
    275275                                           self.protocol, self.port) 
    276             m.use_wsgi = True 
    277             m.run(conf) 
     276            h.use_wsgi = True 
    278277        else: 
    279             TestHarness(self.tests, self.server, 
    280                         self.protocol, self.port).run(conf) 
     278            h = TestHarness(self.tests, self.server, self.protocol, self.port) 
     279         
     280        h.run(conf) 
    281281         
    282282        if self.profile: 
  • trunk/cherrypy/test/test_config.py

    r1312 r1326  
    3535         
    3636        def bar(self, key): 
    37             return cherrypy.request.config.get(key, "None") 
     37            return `cherrypy.request.config.get(key, None)` 
    3838        bar.exposed = True 
    3939        bar._cp_config = {'foo': 'this3', 'bax': 'this4'} 
     
    7676            ('/foo/',    'bar', 'that'), 
    7777            ('/foo/',    'bax', 'None'), 
    78             ('/foo/bar', 'baz', 'that2'), 
     78            ('/foo/bar', 'baz', "'that2'"), 
    7979            ('/foo/nex', 'baz', 'that2'), 
    8080            # If 'foo' == 'this', then the mount point '/another' leaks into '/'. 
     
    8484            self.getPage(path + "?key=" + key) 
    8585            self.assertBody(expected) 
    86      
    87     def testExternalDispatch(self): 
    88         # 'cherrypy.request' should reference a default instance 
    89         cherrypy.request.app = cherrypy.tree.apps[""] 
    90         cherrypy.request.dispatch("/foo/bar") 
     86         
    9187        expectedconf = { 
    9288            # From CP defaults 
     
    107103            'bax': 'this4', 
    108104            } 
    109         for k, v in expectedconf.iteritems(): 
    110             self.assertEqual(cherrypy.request.config[k], v) 
     105        for key, expected in expectedconf.iteritems(): 
     106            self.getPage("/foo/bar?key=" + key) 
     107            self.assertBody(`expected`) 
    111108 
    112109 
  • trunk/cherrypy/test/test_conn.py

    r1288 r1326  
    114114            httpserver = cherrypy.server.httpservers.keys()[0] 
    115115            old_timeout = httpserver.timeout 
    116         except AttributeError
     116        except (AttributeError, IndexError)
    117117            print "skipped ", 
    118118            return 
     
    277277            return 
    278278         
     279        if (hasattr(self, 'harness') and 
     280            "modpython" in self.harness.__class__.__name__.lower()): 
     281            # mod_python forbids chunked encoding 
     282            print "skipped ", 
     283            return 
     284         
    279285        self.PROTOCOL = "HTTP/1.1" 
    280286         
  • trunk/cherrypy/test/test_core.py

    r1325 r1326  
    648648        self.assertInBody(msg) 
    649649         
    650         # Test throw_errors (ticket #186). 
    651         self.getPage("/error/rethrow") 
    652         self.assertInBody("raise ValueError()") 
     650        # Ugly hack to skip the test if we're using _cpmodpy. 
     651        if cherrypy.servers.httpservers: 
     652            # Test throw_errors (ticket #186). 
     653            self.getPage("/error/rethrow") 
     654            self.assertInBody("raise ValueError()") 
    653655     
    654656    def testRanges(self): 
  • trunk/cherrypy/test/test_wsgi_ns.py

    r1320 r1326  
    22test.prefer_parent_path() 
    33 
     4import cherrypy 
     5 
    46 
    57def setup_server(): 
    6      
    7     import cherrypy 
    8      
    98     
    109    class ChangeCase(object): 
     
    5655     
    5756    def test_pipeline(self): 
     57        if not cherrypy.server.httpservers: 
     58            print "skipped ", 
     59            return 
     60         
    5861        self.getPage("/") 
    5962        # If body is "HEXXO WORXD!", the middleware was applied out of order. 

Hosted by WebFaction

Log in as guest/cpguest to create tickets