* added damn notworking twill tests

This commit is contained in:
age 2006-09-05 00:15:43 +00:00
parent fccfba66d7
commit 9ef218872a
3 changed files with 60 additions and 0 deletions

View file

@ -30,6 +30,7 @@ class CryptoBoxWebserver:
''' '''
def start(self): def start(self):
# just use this config, when we're startet directly
cherrypy.config.update(file = "cryptoboxwebserver.conf") cherrypy.config.update(file = "cryptoboxwebserver.conf")
cherrypy.server.start() cherrypy.server.start()

View file

@ -170,6 +170,9 @@ class CryptoBoxWebserverSites(CryptoBox.CryptoBoxProps, CryptoBoxWebserverSettin
self.__prepare("show_status") self.__prepare("show_status")
return website.render(self) return website.render(self)
def test(self):
return "test passed"
def umount_do(self): def umount_do(self):
if not __isHDAvailable(): if not __isHDAvailable():
pass pass
@ -233,5 +236,6 @@ class CryptoBoxWebserverSites(CryptoBox.CryptoBoxProps, CryptoBoxWebserverSettin
logs.exposed = True logs.exposed = True
system.exposed = True system.exposed = True
status.exposed = True status.exposed = True
test.exposed = True

View file

@ -0,0 +1,55 @@
import twill
import cherrypy
import CryptoBoxWebserverSites
class TestIt:
'''this will be the testclass of the webserver, using "twill"
one way to manually run twill code is through the python
interpreter commandline e.g.:
import twill
twill.shell.main()
go http://localhost:8080
find "my very special html content"
help
'''
def setUp(self):
cherrypy.config.update({
'server.logToScreen' : True,
'autoreload.on': False,
'server.threadPool': 1,
'server.environment': 'production',
})
cherrypy.root = CryptoBoxWebserverSites.CryptoBoxWebserverSites()
from cherrypy._cpwsgi import wsgiApp
twill.add_wsgi_intercept('localhost', 8081, lambda: wsgiApp)
#output = open("foolog","w")
#twill.set_output(output)
def tearDown(self):
# remove intercept.
twill.remove_wsgi_intercept('localhost', 8081)
# shut down the cherrypy server.
cherrypy.server.stop()
#output.close()
def test_01(self):
twill.commands.go("http://localhost:8081/")
twill.commands.show()
if __name__ == "__main__":
t = TestIt()
t.setUp()
t.test_01()
t.tearDown()