Removed spurious static_path.
[smonitor.git] / monitor / cherrypy / test / test_wsgi_vhost.py
blobabb1a9170244f81fc14bc57138a8f36738ba3364
1 import cherrypy
2 from cherrypy.test import helper
5 class WSGI_VirtualHost_Test(helper.CPWebCase):
7 def setup_server():
9 class ClassOfRoot(object):
11 def __init__(self, name):
12 self.name = name
14 def index(self):
15 return "Welcome to the %s website!" % self.name
16 index.exposed = True
19 default = cherrypy.Application(None)
21 domains = {}
22 for year in range(1997, 2008):
23 app = cherrypy.Application(ClassOfRoot('Class of %s' % year))
24 domains['www.classof%s.example' % year] = app
26 cherrypy.tree.graft(cherrypy._cpwsgi.VirtualHost(default, domains))
27 setup_server = staticmethod(setup_server)
29 def test_welcome(self):
30 if not cherrypy.server.using_wsgi:
31 return self.skip("skipped (not using WSGI)... ")
33 for year in range(1997, 2008):
34 self.getPage("/", headers=[('Host', 'www.classof%s.example' % year)])
35 self.assertBody("Welcome to the Class of %s website!" % year)