cryptonas/src/cryptobox/tests/test.websites.py
2006-11-30 14:50:28 +00:00

63 lines
1.8 KiB
Python
Executable file

#!/usr/bin/env python2.4
#
# Copyright 2006 sense.lab e.V.
#
# This file is part of the CryptoBox.
#
# The CryptoBox is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# The CryptoBox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the CryptoBox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
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 cryptobox.web.testclass
class WebServer(cryptobox.web.testclass.WebInterfaceTestClass):
def test_is_server_running(self):
'''the server should run under given name and port'''
self.register_auth(self.URL)
self.cmd.go(self.URL)
self.cmd.find("CBOX-STATUS")
## other URLs must not be checked, as we do not know, if they are valid
class BuiltinPages(cryptobox.web.testclass.WebInterfaceTestClass):
def test_goto_index(self):
'''display all devices'''
self.register_auth(self.URL)
self.cmd.go(self.URL)
self.cmd.find("The CryptoBox")
self.cmd.go(self.URL + "?weblang=de")
self.cmd.find("Die CryptoBox")
self.cmd.go(self.URL + "?weblang=sl")
self.cmd.find("Privatnost v vsako vas")
self.cmd.go(self.URL + "?weblang=fr")
self.cmd.find("La CryptoBox")
if __name__ == "__main__":
unittest.main()