/usr/lib/python2.7/dist-packages/cherrypy/test/test_logdebuginfo_filter.py is in python-cherrypy 2.3.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import test
test.prefer_parent_path()
import cherrypy
def setup_server():
class Root:
def index(self):
yield "Hello, world"
index.exposed = True
def bug326(self, file):
return "OK"
bug326.exposed = True
cherrypy.root = Root()
cherrypy.config.update({
'server.log_to_screen': False,
'server.environment': 'production',
'log_debug_info_filter.on': True,
'/bug326': {
'server.max_request_body_size': 300,
'server.environment': 'development',
}
})
import helper
class LogDebugInfoFilterTest(helper.CPWebCase):
def testLogDebugInfoFilter(self):
self.getPage('/')
self.assertInBody('Build time')
self.assertInBody('Page size')
# not compatible with the session_filter
#self.assertInBody('Session data size')
def testBug326(self):
b = """--x
Content-Disposition: form-data; name="file"; filename="hello.txt"
Content-Type: text/plain
%s
--x--
""" % ("x" * 300)
h = [("Content-type", "multipart/form-data; boundary=x"),
("Content-Length", len(b))]
self.getPage('/bug326', h, "POST", b)
self.assertStatus("413 Request Entity Too Large")
if __name__ == "__main__":
setup_server()
helper.testmain()
|