master.slave[-1] = val now works correctly
This commit is contained in:
parent
7305cfa134
commit
f03a31b454
|
@ -382,6 +382,35 @@ def test_reset_values_with_master_and_slaves_default():
|
|||
assert cfg.ip_admin_eth0.netmask_admin_eth0 == [None]
|
||||
|
||||
|
||||
def test_reset_values_with_master_and_slaves_setitem():
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True, default=['192.168.230.145'])
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau", multi=True)
|
||||
interface1 = OptionDescription('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||
interface1.impl_set_group_type(groups.master)
|
||||
maconfig = OptionDescription('toto', '', [interface1])
|
||||
cfg = Config(maconfig)
|
||||
cfg.read_write()
|
||||
owner = cfg.cfgimpl_get_settings().getowner()
|
||||
assert cfg.getowner(ip_admin_eth0) == owners.default
|
||||
assert cfg.getowner(netmask_admin_eth0) == owners.default
|
||||
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.append("192.168.230.146")
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.append("192.168.230.146")
|
||||
cfg.ip_admin_eth0.ip_admin_eth0.append("192.168.230.146")
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0[-1] == None
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0[3] == None
|
||||
assert cfg.getowner(netmask_admin_eth0, 3) == owners.default
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0[-1] = "255.255.255.0"
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0[-1] == "255.255.255.0"
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0[3] == "255.255.255.0"
|
||||
assert cfg.getowner(netmask_admin_eth0, 3) == owner
|
||||
#
|
||||
assert cfg.getowner(netmask_admin_eth0, 2) == owners.default
|
||||
cfg.ip_admin_eth0.netmask_admin_eth0[2] = "255.255.0.0"
|
||||
assert cfg.ip_admin_eth0.netmask_admin_eth0[-2] == "255.255.0.0"
|
||||
assert cfg.getowner(netmask_admin_eth0, 2) == owner
|
||||
|
||||
|
||||
def test_values_with_master_and_slaves_slave():
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau", multi=True)
|
||||
|
|
|
@ -725,6 +725,8 @@ class Multi(list):
|
|||
context = self._getcontext()
|
||||
setting = context.cfgimpl_get_settings()
|
||||
setting_properties = setting._getproperties(read_write=False)
|
||||
if index < 0:
|
||||
index = self.__len__() + index
|
||||
if 'validator' in setting_properties and validate:
|
||||
fake_context = context._gen_fake_values()
|
||||
fake_multi = fake_context.cfgimpl_get_values()._get_cached_value(
|
||||
|
|
Loading…
Reference in New Issue