2006-11-06 17:05:00 +01:00
|
|
|
#!/usr/bin/env python2.4
|
2006-11-30 15:50:28 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2006-12-05 13:24:47 +01:00
|
|
|
"""Base class for all unittests involving the webserver.
|
|
|
|
|
|
|
|
This class uses twill.
|
|
|
|
"""
|
|
|
|
|
|
|
|
__revision__ = "$Id"
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
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
|
2006-11-23 20:13:08 +01:00
|
|
|
import cryptobox.web.testclass
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-11-23 20:13:08 +01:00
|
|
|
class WebServer(cryptobox.web.testclass.WebInterfaceTestClass):
|
2006-12-05 13:24:47 +01:00
|
|
|
"""Basic tests for the webserver.
|
|
|
|
"""
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
def test_is_server_running(self):
|
|
|
|
'''the server should run under given name and port'''
|
2006-12-05 13:24:47 +01:00
|
|
|
self.register_auth(self.url)
|
|
|
|
self.cmd.go(self.url)
|
2006-11-30 15:50:28 +01:00
|
|
|
self.cmd.find("CBOX-STATUS")
|
2006-11-06 17:05:00 +01:00
|
|
|
## other URLs must not be checked, as we do not know, if they are valid
|
|
|
|
|
|
|
|
|
2006-11-23 20:13:08 +01:00
|
|
|
class BuiltinPages(cryptobox.web.testclass.WebInterfaceTestClass):
|
2006-12-05 13:24:47 +01:00
|
|
|
"""Basic test of builtin pages (no features).
|
|
|
|
"""
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_goto_index(self):
|
|
|
|
'''display all devices'''
|
2006-12-05 13:24:47 +01:00
|
|
|
self.register_auth(self.url)
|
|
|
|
self.cmd.go(self.url)
|
2006-11-06 17:05:00 +01:00
|
|
|
self.cmd.find("The CryptoBox")
|
2006-12-05 13:24:47 +01:00
|
|
|
self.cmd.go(self.url + "?weblang=de")
|
2006-11-06 17:05:00 +01:00
|
|
|
self.cmd.find("Die CryptoBox")
|
2006-12-05 13:24:47 +01:00
|
|
|
self.cmd.go(self.url + "?weblang=sl")
|
2006-11-06 17:05:00 +01:00
|
|
|
self.cmd.find("Privatnost v vsako vas")
|
2006-12-05 13:24:47 +01:00
|
|
|
self.cmd.go(self.url + "?weblang=fr")
|
2006-11-06 17:05:00 +01:00
|
|
|
self.cmd.find("La CryptoBox")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|
|
|
|
|