add SlaveError for slave's length
This commit is contained in:
@ -4,6 +4,7 @@ from tiramisu.setting import groups, owners
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import ChoiceOption, BoolOption, IntOption, \
|
||||
StrOption, OptionDescription
|
||||
from tiramisu.error import SlaveError
|
||||
|
||||
from py.test import raises
|
||||
|
||||
@ -185,18 +186,18 @@ def test_values_with_master_and_slaves_slave():
|
||||
maconfig = OptionDescription('toto', '', [interface1])
|
||||
cfg = Config(maconfig)
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0 == []
|
||||
raises(ValueError, "cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0']")
|
||||
raises(SlaveError, "cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0']")
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.append("192.168.230.145")
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0']
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0[0] = '255.255.255.0'
|
||||
raises(ValueError, "cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0', '255.255.255.0']")
|
||||
raises(ValueError, "cfg.ip_admin_eth0.netmask_admin_eth0 = []")
|
||||
raises(SlaveError, "cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0', '255.255.255.0']")
|
||||
raises(SlaveError, "cfg.ip_admin_eth0.netmask_admin_eth0 = []")
|
||||
del(cfg.ip_admin_eth0.netmask_admin_eth0)
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0']
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.append("192.168.230.145")
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0 == ['255.255.255.0', None]
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0', '255.255.255.0']
|
||||
raises(ValueError, 'cfg.ip_admin_eth0.netmask_admin_eth0.pop(1)')
|
||||
raises(SlaveError, 'cfg.ip_admin_eth0.netmask_admin_eth0.pop(1)')
|
||||
|
||||
|
||||
def test_values_with_master_and_slaves_master():
|
||||
@ -210,6 +211,6 @@ def test_values_with_master_and_slaves_master():
|
||||
cfg.ip_admin_eth0.ip_admin_eth0 = ["192.168.230.145"]
|
||||
cfg.ip_admin_eth0.ip_admin_eth0 = ["192.168.230.145", "192.168.230.145"]
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0 = ['255.255.255.0', '255.255.255.0']
|
||||
raises(ValueError, 'cfg.ip_admin_eth0.ip_admin_eth0 = ["192.168.230.145"]')
|
||||
raises(SlaveError, 'cfg.ip_admin_eth0.ip_admin_eth0 = ["192.168.230.145"]')
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.pop(1)
|
||||
assert cfg.ip_admin_eth0.ip_admin_eth0 == ["192.168.230.145"]
|
||||
|
Reference in New Issue
Block a user