base unittest class for the web interface added
unittests for builtin pages seperated from plugin unittests plugin unittest framework added
This commit is contained in:
parent
a2043742e0
commit
d1d2e1edd5
4 changed files with 165 additions and 140 deletions
55
pythonrewrite/bin/unittests.WebSites.py
Executable file
55
pythonrewrite/bin/unittests.WebSites.py
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/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_help_pages(self):
|
||||
'''help pages should be available in different languages'''
|
||||
|
||||
## check english help pages
|
||||
self.cmd.go(self.URL + "doc?weblang=en")
|
||||
self.cmd.find("Table of Contents")
|
||||
self.cmd.find("Getting started")
|
||||
|
||||
self.cmd.go(self.URL + "doc?weblang=de")
|
||||
self.cmd.find("Table of Contents")
|
||||
self.cmd.find("Wie geht es los")
|
||||
|
||||
self.cmd.go(self.URL + "doc?weblang=si")
|
||||
self.assertRaises(TwillAssertionError, self.cmd.notfind, "Table of Contents")
|
||||
#TODO: add a slovene text here, as soon as the help is translated
|
||||
|
||||
|
||||
def test_goto_status(self):
|
||||
'''display all active devices'''
|
||||
self.cmd.go(self.URL + "status")
|
||||
self.cmd.find("Status")
|
||||
|
||||
|
||||
def test_goto_system(self):
|
||||
self.cmd.go(self.URL + "system")
|
||||
self.cmd.find("System")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue