/usr/share/pyshared/cherrypy/test/test_baseurl_filter.py is in python-cherrypy 2.3.0-3build1.
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 | import test
test.prefer_parent_path()
import cherrypy
def setup_server():
class Root:
def index(self):
raise cherrypy.HTTPRedirect('dummy')
index.exposed = True
cherrypy.tree.mount(Root())
cherrypy.config.update({
'server.environment': 'production',
'server.log_to_screen': False,
'base_url_filter.on': True,
'base_url_filter.base_url': 'http://www.mydomain.com'
})
import helper
class BaseUrlFilterTest(helper.CPWebCase):
def testBaseUrlFilter(self):
self.getPage("/")
self.assertHeader('Location',
"http://www.mydomain.com%s/dummy" % self.prefix())
if __name__ == '__main__':
setup_server()
helper.testmain()
|