fixed some unittests
This commit is contained in:
parent
36fadb44e5
commit
5ea8e7836d
|
@ -2,6 +2,7 @@ Version 0.3.3 - 01/26/02007
|
||||||
* fixed bug in reinitializing of plugins (Closes: #111)
|
* fixed bug in reinitializing of plugins (Closes: #111)
|
||||||
* fixed broken group membership changing of webserver (Closes: #114)
|
* fixed broken group membership changing of webserver (Closes: #114)
|
||||||
* fixed glitch that delayed the effect of changes made by the plugin_manager
|
* fixed glitch that delayed the effect of changes made by the plugin_manager
|
||||||
|
* ignore devices without read and write permissions
|
||||||
* completed Slovenian translation
|
* completed Slovenian translation
|
||||||
* improved German translation
|
* improved German translation
|
||||||
* added: restore network settings during startup
|
* added: restore network settings during startup
|
||||||
|
|
|
@ -29,5 +29,6 @@ class unittests(WebInterfaceTestClass):
|
||||||
url = self.url + "encrypted_webinterface"
|
url = self.url + "encrypted_webinterface"
|
||||||
self.register_auth(url)
|
self.register_auth(url)
|
||||||
self.cmd.go(url)
|
self.cmd.go(url)
|
||||||
self.cmd.find("Data.Status.Plugins.encrypted_webinterface")
|
## TODO: enable it, as soon as the plugin is enabled by default
|
||||||
|
#self.cmd.find("Data.Status.Plugins.encrypted_webinterface")
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class unittests(WebInterfaceTestClass):
|
||||||
url = self.url + "language_selection?weblang=en"
|
url = self.url + "language_selection?weblang=en"
|
||||||
self.register_auth(url)
|
self.register_auth(url)
|
||||||
self.cmd.go(url)
|
self.cmd.go(url)
|
||||||
self.cmd.find('Choose an interface language')
|
self.cmd.find('Choose your tongue')
|
||||||
|
|
||||||
|
|
||||||
def test_check_language_list(self):
|
def test_check_language_list(self):
|
||||||
|
|
|
@ -46,10 +46,10 @@ class unittests(WebInterfaceTestClass):
|
||||||
self.assertEquals(4, len(orig_ip_octs))
|
self.assertEquals(4, len(orig_ip_octs))
|
||||||
def set_ip((ip1, ip2, ip3, ip4)):
|
def set_ip((ip1, ip2, ip3, ip4)):
|
||||||
self.cmd.go(self.url + "network")
|
self.cmd.go(self.url + "network")
|
||||||
self.cmd.formvalue("set_ip", "ip1", str(ip1))
|
self.cmd.formvalue("network_address", "ip1", str(ip1))
|
||||||
self.cmd.formvalue("set_ip", "ip2", str(ip2))
|
self.cmd.formvalue("network_address", "ip2", str(ip2))
|
||||||
self.cmd.formvalue("set_ip", "ip3", str(ip3))
|
self.cmd.formvalue("network_address", "ip3", str(ip3))
|
||||||
self.cmd.formvalue("set_ip", "ip4", str(ip4))
|
self.cmd.formvalue("network_address", "ip4", str(ip4))
|
||||||
self.cmd.submit()
|
self.cmd.submit()
|
||||||
## sleep a little bit longer than the delay necessary for ip-change
|
## sleep a little bit longer than the delay necessary for ip-change
|
||||||
time.sleep(CHANGE_IP_DELAY + 3)
|
time.sleep(CHANGE_IP_DELAY + 3)
|
||||||
|
@ -73,6 +73,6 @@ class unittests(WebInterfaceTestClass):
|
||||||
self.register_auth(self.url + "network")
|
self.register_auth(self.url + "network")
|
||||||
self.cmd.go(self.url + "network" + "?redirected=1")
|
self.cmd.go(self.url + "network" + "?redirected=1")
|
||||||
self.cmd.notfind("problem")
|
self.cmd.notfind("problem")
|
||||||
self.cmd.go(self.url + "network" + "?store=1")
|
self.cmd.go(self.url + "network" + "?store=set_ip")
|
||||||
self.cmd.find("invalid network address")
|
self.cmd.find("invalid network address")
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class unittests(WebInterfaceTestClass):
|
||||||
def test_read_users(self):
|
def test_read_users(self):
|
||||||
"""does the 'admin' user exist?"""
|
"""does the 'admin' user exist?"""
|
||||||
cur_users = self._getUsers()
|
cur_users = self._getUsers()
|
||||||
self.cmd.find("Manage users")
|
self.cmd.find("Add new user")
|
||||||
self.assertTrue("admin" in cur_users)
|
self.assertTrue("admin" in cur_users)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class unittests(WebInterfaceTestClass):
|
||||||
url = self.url + "volume_mount?weblang=en&device=" + self.device_html
|
url = self.url + "volume_mount?weblang=en&device=" + self.device_html
|
||||||
self.register_auth(url)
|
self.register_auth(url)
|
||||||
self.cmd.go(url)
|
self.cmd.go(url)
|
||||||
self.cmd.find('Open volume')
|
self.cmd.find('Open this volume')
|
||||||
self.cmd.find('Data.Status.Plugins.volume_mount=passive')
|
self.cmd.find('Data.Status.Plugins.volume_mount=passive')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class unittests(WebInterfaceTestClass):
|
||||||
cbox_tools.umount(self.device)
|
cbox_tools.umount(self.device)
|
||||||
## check a language string
|
## check a language string
|
||||||
self.cmd.go(url)
|
self.cmd.go(url)
|
||||||
self.cmd.find('Change the name of this volume')
|
self.cmd.find('Change name')
|
||||||
|
|
||||||
|
|
||||||
def test_rename(self):
|
def test_rename(self):
|
||||||
|
|
|
@ -51,6 +51,8 @@ class CryptoBoxSettings:
|
||||||
config_file = self.__get_config_filename(config_file)
|
config_file = self.__get_config_filename(config_file)
|
||||||
self.log.info("loading config file: %s" % config_file)
|
self.log.info("loading config file: %s" % config_file)
|
||||||
self.prefs = self.__get_preferences(config_file)
|
self.prefs = self.__get_preferences(config_file)
|
||||||
|
if not "PluginSettings" in self.prefs:
|
||||||
|
self.prefs["PluginSettings"] = {}
|
||||||
self.__validate_config()
|
self.__validate_config()
|
||||||
self.__configure_log_handler()
|
self.__configure_log_handler()
|
||||||
self.__check_unknown_preferences()
|
self.__check_unknown_preferences()
|
||||||
|
|
|
@ -56,7 +56,23 @@ class CryptoBoxPlugin:
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, cbox, plugin_dir, site_class=None):
|
def __init__(self, cbox, plugin_dir, site_class=None):
|
||||||
self.cbox = cbox
|
if cbox:
|
||||||
|
self.cbox = cbox
|
||||||
|
else:
|
||||||
|
## define empty dummy class as a replacement for a cbox instance
|
||||||
|
class CBoxPrefs(dict):
|
||||||
|
plugin_conf = {}
|
||||||
|
class CBoxLogger:
|
||||||
|
def debug(self, text):
|
||||||
|
pass
|
||||||
|
info = debug
|
||||||
|
warn = debug
|
||||||
|
error = debug
|
||||||
|
class CBoxMinimal:
|
||||||
|
prefs = CBoxPrefs()
|
||||||
|
prefs["PluginSettings"] = {}
|
||||||
|
log = CBoxLogger()
|
||||||
|
self.cbox = CBoxMinimal()
|
||||||
self.hdf = {}
|
self.hdf = {}
|
||||||
self.plugin_dir = plugin_dir
|
self.plugin_dir = plugin_dir
|
||||||
self.hdf_prefix = "Data.Plugins.%s." % self.get_name()
|
self.hdf_prefix = "Data.Plugins.%s." % self.get_name()
|
||||||
|
|
|
@ -41,9 +41,7 @@ class CryptoBoxDeviceTests(CommonTestClass):
|
||||||
|
|
||||||
def test_allowed_devices(self):
|
def test_allowed_devices(self):
|
||||||
'''is_device_allowed should accept permitted devices'''
|
'''is_device_allowed should accept permitted devices'''
|
||||||
self.assertTrue(self.cb.is_device_allowed("/dev/loop"))
|
|
||||||
self.assertTrue(self.cb.is_device_allowed("/dev/loop1"))
|
self.assertTrue(self.cb.is_device_allowed("/dev/loop1"))
|
||||||
self.assertTrue(self.cb.is_device_allowed("/dev/loop/urgd"))
|
|
||||||
self.assertTrue(self.cb.is_device_allowed("/dev/usb/../loop1"))
|
self.assertTrue(self.cb.is_device_allowed("/dev/usb/../loop1"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +50,8 @@ class CryptoBoxDeviceTests(CommonTestClass):
|
||||||
self.assertFalse(self.cb.is_device_allowed("/dev/hda"))
|
self.assertFalse(self.cb.is_device_allowed("/dev/hda"))
|
||||||
self.assertFalse(self.cb.is_device_allowed("/dev/loopa/../hda"))
|
self.assertFalse(self.cb.is_device_allowed("/dev/loopa/../hda"))
|
||||||
self.assertFalse(self.cb.is_device_allowed("/"))
|
self.assertFalse(self.cb.is_device_allowed("/"))
|
||||||
|
## this device does not exist -> no permission check possible
|
||||||
|
self.assertFalse(self.cb.is_device_allowed("/dev/loop"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ Button {
|
||||||
AdviceMessage {
|
AdviceMessage {
|
||||||
|
|
||||||
VolumeIsBusy {
|
VolumeIsBusy {
|
||||||
Title = Disk is busy
|
Title = Busy volume
|
||||||
Text = This disk is currently busy. Please wait for a moment.
|
Text = This volume is currently busy. Please wait for a moment.
|
||||||
Link.Rel = /
|
Link.Rel = /
|
||||||
Link.Text = Show all disks
|
Link.Text = Show all disks
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue