2006-12-19 20:03:43 +01:00
|
|
|
#!/usr/bin/env python
|
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.
|
|
|
|
"""
|
|
|
|
|
2007-03-21 19:35:31 +01:00
|
|
|
__revision__ = "$Id$"
|
2006-11-06 17:05:00 +01:00
|
|
|
|
2007-01-08 06:08:07 +01:00
|
|
|
from cryptobox.tests.base import WebInterfaceTestClass
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-08 06:08:07 +01:00
|
|
|
class WebServer(WebInterfaceTestClass):
|
2007-08-18 02:45:12 +02:00
|
|
|
"""Basic tests for the webserver.
|
|
|
|
"""
|
2006-11-06 17:05:00 +01:00
|
|
|
|
2007-08-18 02:45:12 +02:00
|
|
|
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
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
|
2007-01-08 06:08:07 +01:00
|
|
|
|
|
|
|
class BuiltinPages(WebInterfaceTestClass):
|
2007-08-18 02:45:12 +02:00
|
|
|
"""Basic test of builtin pages (no features).
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def test_goto_index(self):
|
|
|
|
'''display all devices'''
|
|
|
|
self.register_auth(self.url)
|
|
|
|
self.cmd.go(self.url)
|
2009-02-28 08:27:02 +01:00
|
|
|
self.cmd.find("The CryptoNAS")
|
2007-08-18 02:45:12 +02:00
|
|
|
self.cmd.go(self.url + "?weblang=de")
|
2009-02-28 08:27:02 +01:00
|
|
|
self.cmd.find("Die CryptoNAS")
|
2007-08-18 02:45:12 +02:00
|
|
|
self.cmd.go(self.url + "?weblang=sl")
|
2009-02-28 08:27:02 +01:00
|
|
|
self.cmd.find("CryptoNAS je projekt")
|
2007-08-18 02:45:12 +02:00
|
|
|
self.cmd.go(self.url + "?weblang=fr")
|
2009-02-28 08:27:02 +01:00
|
|
|
self.cmd.find("La CryptoNAS")
|
2006-11-06 17:05:00 +01:00
|
|
|
|