* added damn notworking twill tests
This commit is contained in:
parent
fccfba66d7
commit
9ef218872a
3 changed files with 60 additions and 0 deletions
|
@ -30,6 +30,7 @@ class CryptoBoxWebserver:
|
|||
'''
|
||||
|
||||
def start(self):
|
||||
# just use this config, when we're startet directly
|
||||
cherrypy.config.update(file = "cryptoboxwebserver.conf")
|
||||
cherrypy.server.start()
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ class CryptoBoxWebserverSites(CryptoBox.CryptoBoxProps, CryptoBoxWebserverSettin
|
|||
self.__prepare("show_status")
|
||||
return website.render(self)
|
||||
|
||||
def test(self):
|
||||
return "test passed"
|
||||
|
||||
def umount_do(self):
|
||||
if not __isHDAvailable():
|
||||
pass
|
||||
|
@ -233,5 +236,6 @@ class CryptoBoxWebserverSites(CryptoBox.CryptoBoxProps, CryptoBoxWebserverSettin
|
|||
logs.exposed = True
|
||||
system.exposed = True
|
||||
status.exposed = True
|
||||
test.exposed = True
|
||||
|
||||
|
||||
|
|
55
pythonrewrite/bin2/exp.twilltest.CryptoBoxWebserverSites.py
Normal file
55
pythonrewrite/bin2/exp.twilltest.CryptoBoxWebserverSites.py
Normal 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()
|
||||
|
||||
|
Loading…
Reference in a new issue