wrong leadership name in dict()
This commit is contained in:
parent
f0be02b80f
commit
d3d4de7ae3
|
@ -298,6 +298,32 @@ async def test_groups_with_leader_make_dict(config_type):
|
|||
assert not await list_sessions()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_groups_with_leader_make_dict2(config_type):
|
||||
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)
|
||||
interface1 = Leadership('other', '', [ip_admin_eth0, netmask_admin_eth0])
|
||||
od = OptionDescription('root', '', [interface1])
|
||||
async with await Config(od) as cfg:
|
||||
cfg = await get_config(cfg, config_type)
|
||||
assert await cfg.value.dict() == {'other.ip_admin_eth0': [], 'other.netmask_admin_eth0': []}
|
||||
assert await cfg.value.dict(leader_to_list=True) == {'other.ip_admin_eth0': []}
|
||||
if config_type != 'tiramisu-api':
|
||||
# FIXME useful? already in leadership
|
||||
assert await cfg.option('other.ip_admin_eth0').value.len() == 0
|
||||
assert await cfg.option('other.netmask_admin_eth0').value.len() == 0
|
||||
await cfg.option('other.ip_admin_eth0').value.set(['ip1', 'ip2'])
|
||||
if config_type != 'tiramisu-api':
|
||||
# FIXME
|
||||
assert await cfg.option('other.ip_admin_eth0').value.len() == 2
|
||||
assert await cfg.option('other.netmask_admin_eth0').value.len() == 2
|
||||
assert await cfg.value.dict() == {'other.ip_admin_eth0': ['ip1', 'ip2'], 'other.netmask_admin_eth0': [None, None]}
|
||||
assert await cfg.value.dict(leader_to_list=True) == {'other.ip_admin_eth0': [{'other.ip_admin_eth0': 'ip1', 'other.netmask_admin_eth0': None}, {'other.ip_admin_eth0': 'ip2', 'other.netmask_admin_eth0': None}]}
|
||||
if config_type == 'tiramisu-api':
|
||||
await cfg.send()
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_groups_with_leader_default_value(config_type):
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
|
||||
|
|
|
@ -421,7 +421,8 @@ class SubConfig:
|
|||
flatten,
|
||||
fullpath,
|
||||
pathsvalues,
|
||||
leader_to_list)
|
||||
leader_to_list,
|
||||
)
|
||||
return pathsvalues
|
||||
|
||||
async def _make_dict(self,
|
||||
|
@ -442,7 +443,7 @@ class SubConfig:
|
|||
config_bag)
|
||||
loption_bag.properties = await self.cfgimpl_get_settings().getproperties(loption_bag)
|
||||
leader_pathsvalues = {}
|
||||
leader_currpath = _currpath + [leader.impl_getname()]
|
||||
leader_currpath = _currpath + [opt.impl_getname()]
|
||||
await self._make_sub_dict(leader_pathsvalues,
|
||||
leader_currpath,
|
||||
loption_bag,
|
||||
|
|
Loading…
Reference in New Issue