mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-11 03:45:01 -05:00
cec4ed573d
Switched out sqlite3 libs in favour of SQLAlchemy v0.9, will gradually migrate dialects and scheme to be fully SQLAlchemy compliant for using there ORM with sessions instead of direct. Fixed getEpisode function to stop making unrequired scene number conversions on already converted data thats available now from cache.
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
import cherrypy
|
|
from cherrypy.test import helper
|
|
|
|
|
|
class WSGI_VirtualHost_Test(helper.CPWebCase):
|
|
|
|
def setup_server():
|
|
|
|
class ClassOfRoot(object):
|
|
|
|
def __init__(self, name):
|
|
self.name = name
|
|
|
|
def index(self):
|
|
return "Welcome to the %s website!" % self.name
|
|
index.exposed = True
|
|
|
|
default = cherrypy.Application(None)
|
|
|
|
domains = {}
|
|
for year in range(1997, 2008):
|
|
app = cherrypy.Application(ClassOfRoot('Class of %s' % year))
|
|
domains['www.classof%s.example' % year] = app
|
|
|
|
cherrypy.tree.graft(cherrypy._cpwsgi.VirtualHost(default, domains))
|
|
setup_server = staticmethod(setup_server)
|
|
|
|
def test_welcome(self):
|
|
if not cherrypy.server.using_wsgi:
|
|
return self.skip("skipped (not using WSGI)... ")
|
|
|
|
for year in range(1997, 2008):
|
|
self.getPage(
|
|
"/", headers=[('Host', 'www.classof%s.example' % year)])
|
|
self.assertBody("Welcome to the Class of %s website!" % year)
|