Changeset 2074
- Timestamp:
- 11/08/08 14:35:20
- Files:
-
- branches/cherrypy-3.1.x/cherrypy/test/modfcgid.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/modpy.py (modified) (4 diffs)
- branches/cherrypy-3.1.x/cherrypy/test/modwsgi.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_caching.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_config.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_core.py (modified) (8 diffs)
- branches/cherrypy-3.1.x/cherrypy/test/test_encoding.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_http.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_httpauth.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_objectmapping.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_tools.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_wsgi_vhost.py (modified) (1 diff)
- branches/cherrypy-3.1.x/cherrypy/test/test_wsgiapps.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/cherrypy-3.1.x/cherrypy/test/modfcgid.py
r2068 r2074 105 105 106 106 def _run(self, conf): 107 cherrypy.server.using_wsgi = True 108 cherrypy.server.using_apache = True 107 109 cherrypy.server.httpserver = servers.FlupFCGIServer( 108 110 application=cherrypy.tree, bindAddress=('127.0.0.1', 4000)) branches/cherrypy-3.1.x/cherrypy/test/modpy.py
r1824 r2074 62 62 # Apache2 server conf file for testing CherryPy with modpython_gateway. 63 63 64 ServerName 127.0.0.1 64 65 DocumentRoot "/" 65 66 Listen %s … … 78 79 # Apache2 server conf file for testing CherryPy with _cpmodpy. 79 80 81 ServerName 127.0.0.1 80 82 DocumentRoot "/" 81 83 Listen %s … … 156 158 157 159 def _run(self, conf): 160 import cherrypy 161 cherrypy.server.using_apache = True 162 158 163 from cherrypy.test import webtest 159 164 webtest.WebCase.PORT = self.port … … 165 170 166 171 if self.use_wsgi: 172 cherrypy.server.using_wsgi = True 167 173 conf_template = conf_modpython_gateway 168 174 else: 175 cherrypy.server.using_wsgi = False 169 176 conf_template = conf_cpmodpy 170 177 branches/cherrypy-3.1.x/cherrypy/test/modwsgi.py
r2068 r2074 117 117 118 118 def _run(self, conf): 119 cherrypy.server.using_wsgi = True 120 cherrypy.server.using_apache = True 121 119 122 from cherrypy.test import webtest 120 123 webtest.WebCase.PORT = self.port branches/cherrypy-3.1.x/cherrypy/test/test.py
r2068 r2074 49 49 print "PID:", os.getpid() 50 50 print 51 52 # Override these in _run as needed: 53 cherrypy.server.using_wsgi = True 54 cherrypy.server.using_apache = False 51 55 52 56 if isinstance(conf, basestring): branches/cherrypy-3.1.x/cherrypy/test/test_caching.py
r1797 r2074 205 205 self.assertStatus(304) 206 206 self.assertNoHeader("Last-Modified") 207 self.assertHeader("Age") 207 if not getattr(cherrypy.server, "using_apache", False): 208 self.assertHeader("Age") 208 209 209 210 branches/cherrypy-3.1.x/cherrypy/test/test_config.py
r1724 r2074 171 171 self.assertBody(repr(cherrypy.lib.http.response_codes[404])) 172 172 173 self.getPage("/repr?key=thing2") 174 from cherrypy.tutorial import thing2 175 self.assertBody(repr(thing2)) 173 if not getattr(cherrypy.server, "using_apache", False): 174 # The object ID's won't match up when using Apache, since the 175 # server and client are running in different processes. 176 self.getPage("/repr?key=thing2") 177 from cherrypy.tutorial import thing2 178 self.assertBody(repr(thing2)) 176 179 177 180 self.getPage("/repr?key=complex") branches/cherrypy-3.1.x/cherrypy/test/test_core.py
r2071 r2074 18 18 19 19 defined_http_methods = ("OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", 20 "TRACE", " CONNECT", "PROPFIND")20 "TRACE", "PROPFIND") 21 21 22 22 … … 385 385 def index(self): 386 386 m = cherrypy.request.method 387 if m in defined_http_methods :387 if m in defined_http_methods or m == "CONNECT": 388 388 return m 389 389 … … 589 589 self.assertErrorPage(500, msg) 590 590 591 self.getPage("/status/unknown") 592 self.assertBody('funky') 593 self.assertStatus(431) 591 if not getattr(cherrypy.server, 'using_apache', False): 592 self.getPage("/status/unknown") 593 self.assertBody('funky') 594 self.assertStatus(431) 594 595 595 596 self.getPage("/status/bad") … … 753 754 self.assertErrorPage(500, pattern=valerr) 754 755 755 if cherrypy.server.protocol_version == "HTTP/1.0": 756 if (cherrypy.server.protocol_version == "HTTP/1.0" or 757 getattr(cherrypy.server, "using_apache", False)): 756 758 self.getPage("/error/page_streamed") 757 759 # Because this error is raised after the response body has … … 796 798 self.assertInBody(msg) 797 799 798 if (hasattr(self, 'harness') and 799 "modpython" in self.harness.__class__.__name__.lower()): 800 if getattr(cherrypy.server, "using_apache", False): 800 801 pass 801 802 else: … … 961 962 self.assertBody("application/json") 962 963 963 def test HTTPMethods(self):964 def test_basic_HTTPMethods(self): 964 965 helper.webtest.methods_with_bodies = ("POST", "PUT", "PROPFIND") 965 966 … … 1046 1047 self.assertStatus(200) 1047 1048 1049 def test_CONNECT_method(self): 1050 if getattr(cherrypy.server, "using_apache", False): 1051 print "skipped due to known Apache differences...", 1052 return 1053 1054 self.getPage("/method/", method="CONNECT") 1055 self.assertBody("CONNECT") 1056 1048 1057 def testFavicon(self): 1049 1058 # favicon.ico is served by staticfile. … … 1079 1088 1080 1089 def testMaxRequestSize(self): 1090 if getattr(cherrypy.server, "using_apache", False): 1091 print "skipped due to known Apache differences...", 1092 return 1093 1081 1094 for size in (500, 5000, 50000): 1082 1095 self.getPage("/", headers=[('From', "x" * 500)]) branches/cherrypy-3.1.x/cherrypy/test/test_encoding.py
r2071 r2074 155 155 # and 2) we may have already written some of the body. 156 156 # The fix is to never stream yields when using gzip. 157 if cherrypy.server.protocol_version == "HTTP/1.0": 157 if (cherrypy.server.protocol_version == "HTTP/1.0" or 158 getattr(cherrypy.server, "using_apache", False)): 158 159 self.getPage('/gzip/noshow_stream', 159 160 headers=[("Accept-Encoding", "gzip")]) branches/cherrypy-3.1.x/cherrypy/test/test_http.py
r2068 r2074 105 105 106 106 def test_malformed_request_line(self): 107 if getattr(cherrypy.server, "using_apache", False): 108 print "skipped due to known Apache differences...", 109 return 110 107 111 # Test missing version in Request-Line 108 112 if self.scheme == 'https': branches/cherrypy-3.1.x/cherrypy/test/test_httpauth.py
r1891 r2074 139 139 auth = base_auth % (nonce, response, '00000001') 140 140 self.getPage('/digest/', [('Authorization', auth)]) 141 self.assertStatus( '401 Unauthorized')141 self.assertStatus(401) 142 142 143 143 # Test that must pass branches/cherrypy-3.1.x/cherrypy/test/test_objectmapping.py
r2068 r2074 221 221 self.assertHeader('Location', '%s/dir1/' % self.base()) 222 222 223 # Test that we can use URL's which aren't all valid Python identifiers 224 # This should also test the %XX-unquoting of URL's. 225 self.getPage("/Von%20B%fclow?ID=14") 226 self.assertBody("ID is 14") 227 228 # Test that %2F in the path doesn't get unquoted too early; 229 # that is, it should not be used to separate path components. 230 # See ticket #393. 231 self.getPage("/page%2Fname") 232 self.assertBody("default:('page/name',)") 223 if not getattr(cherrypy.server, "using_apache", False): 224 # Test that we can use URL's which aren't all valid Python identifiers 225 # This should also test the %XX-unquoting of URL's. 226 self.getPage("/Von%20B%fclow?ID=14") 227 self.assertBody("ID is 14") 228 229 # Test that %2F in the path doesn't get unquoted too early; 230 # that is, it should not be used to separate path components. 231 # See ticket #393. 232 self.getPage("/page%2Fname") 233 self.assertBody("default:('page/name',)") 233 234 234 235 self.getPage("/dir1/dir2/script_name") branches/cherrypy-3.1.x/cherrypy/test/test_tools.py
r2071 r2074 264 264 265 265 # If body is "razdrez", then on_end_request is being called too early. 266 if cherrypy.server.protocol_version == "HTTP/1.0": 266 if (cherrypy.server.protocol_version == "HTTP/1.0" or 267 getattr(cherrypy.server, "using_apache", False)): 267 268 self.getPage("/demo/errinstream?id=5") 268 269 # Because this error is raised after the response body has branches/cherrypy-3.1.x/cherrypy/test/test_wsgi_vhost.py
r1670 r2074 35 35 36 36 def test_welcome(self): 37 if not cherrypy.server.using_wsgi: 38 print "skipped (not using WSGI)...", 39 return 40 37 41 for year in xrange(1997, 2008): 38 42 self.getPage("/", headers=[('Host', 'www.classof%s.example' % year)]) branches/cherrypy-3.1.x/cherrypy/test/test_wsgiapps.py
r1804 r2074 89 89 90 90 def test_04_pure_wsgi(self): 91 import cherrypy 92 if not cherrypy.server.using_wsgi: 93 print "skipped (not using WSGI)...", 94 return 91 95 self.getPage("/hosted/app1") 92 96 self.assertHeader("Content-Type", "text/plain") … … 94 98 95 99 def test_05_wrapped_cp_app(self): 100 import cherrypy 101 if not cherrypy.server.using_wsgi: 102 print "skipped (not using WSGI)...", 103 return 96 104 self.getPage("/hosted/app2/") 97 105 body = list("I'm a regular CherryPy page handler!") … … 101 109 102 110 def test_06_empty_string_app(self): 111 import cherrypy 112 if not cherrypy.server.using_wsgi: 113 print "skipped (not using WSGI)...", 114 return 103 115 self.getPage("/hosted/app3") 104 116 self.assertHeader("Content-Type", "text/plain")

