Changeset 1114
- Timestamp:
- 06/01/06 12:05:33
- Files:
-
- trunk/cherrypy/lib/wsgiapp.py (modified) (1 diff)
- trunk/cherrypy/test/test.py (modified) (1 diff)
- trunk/cherrypy/test/test_baseurl.py (moved) (moved from trunk/cherrypy/test/test_baseurl_filter.py) (1 diff)
- trunk/cherrypy/test/test_caching.py (moved) (moved from trunk/cherrypy/test/test_cache_filter.py) (1 diff)
- trunk/cherrypy/test/test_combinedfilters.py (deleted)
- trunk/cherrypy/test/test_decodingencoding.py (moved) (moved from trunk/cherrypy/test/test_decodingencoding_filter.py) (1 diff)
- trunk/cherrypy/test/test_gzip.py (moved) (moved from trunk/cherrypy/test/test_gzip_filter.py) (1 diff)
- trunk/cherrypy/test/test_response_headers.py (moved) (moved from trunk/cherrypy/test/test_response_headers_filter.py) (2 diffs)
- trunk/cherrypy/test/test_session.py (moved) (moved from trunk/cherrypy/test/test_session_filter.py) (1 diff)
- trunk/cherrypy/test/test_sessionauthenticate.py (moved) (moved from trunk/cherrypy/test/test_sessionauthenticate_filter.py) (1 diff)
- trunk/cherrypy/test/test_static.py (moved) (moved from trunk/cherrypy/test/test_static_filter.py) (3 diffs)
- trunk/cherrypy/test/test_tools.py (moved) (moved from trunk/cherrypy/test/test_custom_filters.py) (7 diffs)
- trunk/cherrypy/test/test_tutorials.py (modified) (2 diffs)
- trunk/cherrypy/test/test_virtualhost.py (moved) (moved from trunk/cherrypy/test/test_virtualhost_filter.py) (1 diff)
- trunk/cherrypy/test/test_wsgiapp.py (moved) (moved from trunk/cherrypy/test/test_wsgiapp_filter.py) (2 diffs)
- trunk/cherrypy/test/test_xmlrpc.py (moved) (moved from trunk/cherrypy/test/test_xmlrpc_filter.py) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/wsgiapp.py
r1096 r1114 57 57 environ['PATH_INFO'] = cherrypy.request.path_info 58 58 59 # update the environ with the dict passed to the filter's60 # constructor61 59 if env: 62 60 environ.update(env) trunk/cherrypy/test/test.py
r1099 r1114 289 289 290 290 testList = [ 291 'test_baseurl_filter', 292 'test_cache_filter', 293 'test_combinedfilters', 291 'test_baseurl', 292 'test_caching', 294 293 'test_config', 295 294 'test_core', 296 'test_ custom_filters',297 'test_decodingencoding _filter',298 'test_gzip _filter',295 'test_tools', 296 'test_decodingencoding', 297 'test_gzip', 299 298 'test_objectmapping', 300 'test_response_headers _filter',301 'test_static _filter',299 'test_response_headers', 300 'test_static', 302 301 'test_tutorials', 303 'test_virtualhost _filter',304 'test_session _filter',305 'test_sessionauthenticate _filter',302 'test_virtualhost', 303 'test_session', 304 'test_sessionauthenticate', 306 305 ## 'test_states', 307 'test_xmlrpc _filter',308 'test_wsgiapp _filter',306 'test_xmlrpc', 307 'test_wsgiapp', 309 308 ] 310 309 CommandLineParser(testList).run() trunk/cherrypy/test/test_baseurl.py
r1113 r1114 22 22 import helper 23 23 24 class BaseUrl FilterTest(helper.CPWebCase):24 class BaseUrlTest(helper.CPWebCase): 25 25 26 def testBaseUrl Filter(self):26 def testBaseUrl(self): 27 27 self.getPage("/") 28 28 self.assertHeader('Location', trunk/cherrypy/test/test_caching.py
r1113 r1114 29 29 import helper 30 30 31 class Cache FilterTest(helper.CPWebCase):31 class CacheTest(helper.CPWebCase): 32 32 33 33 def testCaching(self): trunk/cherrypy/test/test_decodingencoding.py
r1113 r1114 32 32 33 33 34 class DecodingEncoding FilterTest(helper.CPWebCase):34 class DecodingEncodingTest(helper.CPWebCase): 35 35 36 def testDecodingEncoding Filter(self):36 def testDecodingEncoding(self): 37 37 europoundUtf8 = europoundUnicode.encode('utf-8') 38 38 self.getPage('/?param=%s' % europoundUtf8) trunk/cherrypy/test/test_gzip.py
r1113 r1114 40 40 europoundUtf8 = u'\x80\xa3'.encode('utf-8') 41 41 42 class Gzip FilterTest(helper.CPWebCase):42 class GzipTest(helper.CPWebCase): 43 43 44 def testGzip Filter(self):44 def testGzip(self): 45 45 zbuf = StringIO.StringIO() 46 46 zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9) trunk/cherrypy/test/test_response_headers.py
r1113 r1114 34 34 import helper 35 35 36 class ResponseHeaders FilterTest(helper.CPWebCase):36 class ResponseHeadersTest(helper.CPWebCase): 37 37 38 38 def testResponseHeadersDecorator(self): … … 41 41 self.assertHeader('Content-Type', 'text/plain') 42 42 43 def testResponseHeaders Filter(self):43 def testResponseHeaders(self): 44 44 self.getPage('/other') 45 45 self.assertHeader("Content-Language", "fr") 46 # Since 'force' is False, the filtershould only change headers46 # Since 'force' is False, the tool should only change headers 47 47 # that have not been set yet. 48 48 # Content-Type should have been set when the response object trunk/cherrypy/test/test_session.py
r1113 r1114 37 37 import helper 38 38 39 class Session FilterTest(helper.CPWebCase):39 class SessionTest(helper.CPWebCase): 40 40 41 def testSession Filter(self):41 def testSession(self): 42 42 self.getPage('/testStr') 43 43 self.assertBody('1') trunk/cherrypy/test/test_sessionauthenticate.py
r1113 r1114 31 31 import helper 32 32 33 class SessionAuthenticate FilterTest(helper.CPWebCase):33 class SessionAuthenticateTest(helper.CPWebCase): 34 34 35 def testSessionAuthenticate Filter(self):35 def testSessionAuthenticate(self): 36 36 # request a page and check for login form 37 37 self.getPage('/') trunk/cherrypy/test/test_static.py
r1113 r1114 59 59 import helper 60 60 61 class Static FilterTest(helper.CPWebCase):61 class StaticTest(helper.CPWebCase): 62 62 63 def testStatic Filter(self):63 def testStatic(self): 64 64 self.getPage("/static/index.html") 65 65 self.assertStatus('200 OK') … … 67 67 self.assertBody('Hello, world\r\n') 68 68 69 # Using a static _filter.root value in a subdir...69 # Using a staticdir.root value in a subdir... 70 70 self.getPage("/docroot/index.html") 71 71 self.assertStatus('200 OK') … … 98 98 self.assertBody('You want the Baron? You can have the Baron!') 99 99 100 # Check a directory via "static _filter.index".100 # Check a directory via "staticdir.index". 101 101 self.getPage("/docroot/") 102 102 self.assertStatus('200 OK') trunk/cherrypy/test/test_tools.py
r1113 r1114 1 """Test the various means of instantiating and invoking filters.""" 2 1 """Test the various means of instantiating and invoking tools.""" 2 3 import gzip, StringIO 3 4 import types 4 5 import test … … 8 9 from cherrypy import tools 9 10 11 12 europoundUnicode = u'\x80\xa3' 10 13 11 14 def setup_server(): … … 65 68 return "Howdy earth!" 66 69 index.exposed = True 70 71 def euro(self): 72 yield u"Hello," 73 yield u"world" 74 yield europoundUnicode 75 euro.exposed = True 76 67 77 root = Root() 68 78 … … 132 142 'tools.numerify.map': "pie->3.14159" 133 143 }, 144 # Combined tools 145 '/euro': { 146 'tools.gzip.on': True, 147 'tools.encode.on': True, 148 }, 134 149 } 135 150 cherrypy.tree.mount(root, conf=conf) … … 141 156 142 157 143 class FilterTests(helper.CPWebCase):158 class ToolTests(helper.CPWebCase): 144 159 145 160 def testDemo(self): … … 173 188 self.assertErrorPage(401) 174 189 175 def testGuaranteed Filters(self):176 # The on_start_resource and on_end_request filter methods are all190 def testGuaranteedHooks(self): 191 # The on_start_resource and on_end_request hooks are all 177 192 # guaranteed to run, even if there are failures in other on_start 178 # or on_end methods. This is NOT true of the other filter methods.179 # Here, we have set up a failure in Numerify Filter.on_start_resource,193 # or on_end methods. This is NOT true of the other hooks. 194 # Here, we have set up a failure in NumerifyTool.on_start_resource, 180 195 # but because that failure is logged and passed over, the error 181 196 # page we obtain in the user agent should be from before_finalize. … … 184 199 self.assertInBody("AttributeError: 'Request' object has no " 185 200 "attribute 'numerify_map'") 201 202 def testCombinedTools(self): 203 expectedResult = (u"Hello,world" + europoundUnicode).encode('utf-8') 204 zbuf = StringIO.StringIO() 205 zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9) 206 zfile.write(expectedResult) 207 zfile.close() 208 209 self.getPage("/euro", headers=[("Accept-Encoding", "gzip")]) 210 self.assertInBody(zbuf.getvalue()[:3]) 186 211 187 212 trunk/cherrypy/test/test_tutorials.py
r1106 r1114 26 26 27 27 app.root.load_tut_module = load_tut_module 28 app.root.sess filteron = sessfilteron28 app.root.sessions = sessions 29 29 app.root.traceback_setting = traceback_setting 30 30 load_tut_module.exposed = True 31 31 32 def sess filteron():33 cherrypy.config.update({" session_filter.on": True})34 sess filteron.exposed = True32 def sessions(): 33 cherrypy.config.update({"tools.sessions.on": True}) 34 sessions.exposed = True 35 35 36 36 def traceback_setting(): … … 118 118 def test07Sessions(self): 119 119 self.getPage("/load_tut_module/tut07_sessions") 120 self.getPage("/sess filteron")120 self.getPage("/sessions") 121 121 122 122 self.getPage('/') trunk/cherrypy/test/test_virtualhost.py
r1113 r1114 48 48 import helper 49 49 50 class VirtualHost FilterTest(helper.CPWebCase):50 class VirtualHostTest(helper.CPWebCase): 51 51 52 def testVirtualHost Filter(self):52 def testVirtualHost(self): 53 53 self.getPage("/", [('Host', 'www.mydom1.com')]) 54 54 self.assertBody('Hello, world') trunk/cherrypy/test/test_wsgiapp.py
r1113 r1114 47 47 48 48 49 class WSGIApp FilterTest(helper.CPWebCase):49 class WSGIAppTest(helper.CPWebCase): 50 50 51 51 wsgi_output = '''Hello, world! … … 56 56 self.assertBody("I'm a regular CherryPy page handler!") 57 57 58 def test_02_ cp_filters(self):58 def test_02_tools(self): 59 59 self.getPage("/hosted/app0") 60 60 self.assertHeader("Content-Type", "text/plain") trunk/cherrypy/test/test_xmlrpc.py
r1113 r1114 68 68 import helper 69 69 70 class XmlRpc FilterTest(helper.CPWebCase):71 def testXmlRpc Filter(self):70 class XmlRpcTest(helper.CPWebCase): 71 def testXmlRpc(self): 72 72 73 73 # load the appropriate xmlrpc proxy

