Changeset 1326
- Timestamp:
- 09/03/06 16:46:36
- Files:
-
- trunk/cherrypy/test/modpy.py (modified) (3 diffs)
- trunk/cherrypy/test/test.py (modified) (2 diffs)
- trunk/cherrypy/test/test_config.py (modified) (4 diffs)
- trunk/cherrypy/test/test_conn.py (modified) (2 diffs)
- trunk/cherrypy/test/test_core.py (modified) (1 diff)
- trunk/cherrypy/test/test_wsgi_ns.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/test/modpy.py
r1319 r1326 16 16 1. Apache processes Range headers automatically; CherryPy's truncated 17 17 output is then truncated again by Apache. See test_core.testRanges. 18 This was worked around in http://www.cherrypy.org/changeset/1319. 18 19 2. Apache does not allow custom HTTP methods like CONNECT as per the spec. 19 20 See test_core.testHTTPMethods. … … 25 26 6. Apache (or perhaps modpython, or modpython_gateway) unquotes %xx in the 26 27 Request-URI too early. 28 7. 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). 27 32 """ 28 33 … … 127 132 from cherrypy.test import webtest 128 133 webtest.WebCase.PORT = self.port 134 webtest.WebCase.harness = self 129 135 print 130 136 print "Running tests:", self.server trunk/cherrypy/test/test.py
r1310 r1326 60 60 from cherrypy.test import helper 61 61 webtest.WebCase.PORT = self.port 62 webtest.WebCase.harness = self 62 63 print 63 64 print "Running tests:", self.server … … 266 267 if self.server == 'cpmodpy': 267 268 from cherrypy.test import modpy 268 m= modpy.ModPythonTestHarness(self.tests, self.server,269 h = modpy.ModPythonTestHarness(self.tests, self.server, 269 270 self.protocol, self.port) 270 m.use_wsgi = False 271 m.run(conf) 271 h.use_wsgi = False 272 272 elif self.server == 'modpygw': 273 273 from cherrypy.test import modpy 274 m= modpy.ModPythonTestHarness(self.tests, self.server,274 h = modpy.ModPythonTestHarness(self.tests, self.server, 275 275 self.protocol, self.port) 276 m.use_wsgi = True 277 m.run(conf) 276 h.use_wsgi = True 278 277 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) 281 281 282 282 if self.profile: trunk/cherrypy/test/test_config.py
r1312 r1326 35 35 36 36 def bar(self, key): 37 return cherrypy.request.config.get(key, "None")37 return `cherrypy.request.config.get(key, None)` 38 38 bar.exposed = True 39 39 bar._cp_config = {'foo': 'this3', 'bax': 'this4'} … … 76 76 ('/foo/', 'bar', 'that'), 77 77 ('/foo/', 'bax', 'None'), 78 ('/foo/bar', 'baz', 'that2'),78 ('/foo/bar', 'baz', "'that2'"), 79 79 ('/foo/nex', 'baz', 'that2'), 80 80 # If 'foo' == 'this', then the mount point '/another' leaks into '/'. … … 84 84 self.getPage(path + "?key=" + key) 85 85 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 91 87 expectedconf = { 92 88 # From CP defaults … … 107 103 'bax': 'this4', 108 104 } 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`) 111 108 112 109 trunk/cherrypy/test/test_conn.py
r1288 r1326 114 114 httpserver = cherrypy.server.httpservers.keys()[0] 115 115 old_timeout = httpserver.timeout 116 except AttributeError:116 except (AttributeError, IndexError): 117 117 print "skipped ", 118 118 return … … 277 277 return 278 278 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 279 285 self.PROTOCOL = "HTTP/1.1" 280 286 trunk/cherrypy/test/test_core.py
r1325 r1326 648 648 self.assertInBody(msg) 649 649 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()") 653 655 654 656 def testRanges(self): trunk/cherrypy/test/test_wsgi_ns.py
r1320 r1326 2 2 test.prefer_parent_path() 3 3 4 import cherrypy 5 4 6 5 7 def setup_server(): 6 7 import cherrypy8 9 8 10 9 class ChangeCase(object): … … 56 55 57 56 def test_pipeline(self): 57 if not cherrypy.server.httpservers: 58 print "skipped ", 59 return 60 58 61 self.getPage("/") 59 62 # If body is "HEXXO WORXD!", the middleware was applied out of order.

