cryptonas/bin/unittests.WebSites.py

40 lines
1002 B
Python
Executable File

#!/usr/bin/env python2.4
import unittest
## this makes assertRaises shorter
from twill.errors import *
from mechanize import BrowserStateError, LinkNotFoundError
## import the module of the common super class of all web interface test classes
import WebInterfaceTestClass
class WebServer(WebInterfaceTestClass.WebInterfaceTestClass):
def test_is_server_running(self):
'''the server should run under given name and port'''
self.cmd.go(self.URL)
## other URLs must not be checked, as we do not know, if they are valid
class BuiltinPages(WebInterfaceTestClass.WebInterfaceTestClass):
def test_goto_index(self):
'''display all devices'''
self.cmd.go(self.URL + "?weblang=en")
self.cmd.find("The CryptoBox")
self.cmd.go(self.URL + "?weblang=de")
self.cmd.find("Die CryptoBox")
self.cmd.go(self.URL + "?weblang=si")
self.cmd.find("Privatnost v vsako vas")
self.cmd.go(self.URL + "?weblang=fr")
self.cmd.find("La CryptoBox")
if __name__ == "__main__":
unittest.main()