fix(api) test option is an optiondescription with a symlink
This commit is contained in:
parent
6805cecfd5
commit
fe2b6fb6a2
2 changed files with 4 additions and 2 deletions
|
@ -317,6 +317,7 @@ def test_symlink_with_follower(config_type):
|
||||||
od1 = OptionDescription('root', '', [interface1, follower])
|
od1 = OptionDescription('root', '', [interface1, follower])
|
||||||
cfg = Config(od1)
|
cfg = Config(od1)
|
||||||
cfg = get_config(cfg, config_type)
|
cfg = get_config(cfg, config_type)
|
||||||
|
assert not cfg.option('follower').option.isoptiondescription()
|
||||||
assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [], 'follower': []}
|
assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [], 'follower': []}
|
||||||
cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2'])
|
cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2'])
|
||||||
assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [{'ip_admin_eth0.ip_admin_eth0': 'val1', 'ip_admin_eth0.netmask_admin_eth0': None}, {'ip_admin_eth0.ip_admin_eth0': 'val2', 'ip_admin_eth0.netmask_admin_eth0': None}], 'follower': [None, None]}
|
assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [{'ip_admin_eth0.ip_admin_eth0': 'val1', 'ip_admin_eth0.netmask_admin_eth0': None}, {'ip_admin_eth0.ip_admin_eth0': 'val2', 'ip_admin_eth0.netmask_admin_eth0': None}], 'follower': [None, None]}
|
||||||
|
|
|
@ -271,7 +271,7 @@ class _TiramisuOptionOptionDescription(CommonTiramisuOption):
|
||||||
))
|
))
|
||||||
return options
|
return options
|
||||||
|
|
||||||
@option_type(['optiondescription', 'option', 'with_or_without_index'])
|
@option_type(['optiondescription', 'option', 'with_or_without_index', 'symlink'])
|
||||||
def isoptiondescription(self, options_bag: List[OptionBag]):
|
def isoptiondescription(self, options_bag: List[OptionBag]):
|
||||||
"""Test if option is an optiondescription"""
|
"""Test if option is an optiondescription"""
|
||||||
option_bag = options_bag[-1]
|
option_bag = options_bag[-1]
|
||||||
|
@ -1415,7 +1415,8 @@ class TiramisuAPI(TiramisuHelp):
|
||||||
if subfunc == 'option':
|
if subfunc == 'option':
|
||||||
config_bag = self._config_bag
|
config_bag = self._config_bag
|
||||||
return TiramisuDispatcherOption(config_bag,
|
return TiramisuDispatcherOption(config_bag,
|
||||||
self._orig_config_bags)
|
self._orig_config_bags,
|
||||||
|
)
|
||||||
if subfunc in ['forcepermissive', 'unrestraint', 'nowarnings']:
|
if subfunc in ['forcepermissive', 'unrestraint', 'nowarnings']:
|
||||||
if self._orig_config_bags:
|
if self._orig_config_bags:
|
||||||
msg = _('do not use unrestraint, nowarnings or forcepermissive together')
|
msg = _('do not use unrestraint, nowarnings or forcepermissive together')
|
||||||
|
|
Loading…
Reference in a new issue