fix(api) test option is an optiondescription with a symlink

This commit is contained in:
egarette@silique.fr 2023-05-16 22:11:55 +02:00
parent 6805cecfd5
commit fe2b6fb6a2
2 changed files with 4 additions and 2 deletions

View file

@ -317,6 +317,7 @@ def test_symlink_with_follower(config_type):
od1 = OptionDescription('root', '', [interface1, follower])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert not cfg.option('follower').option.isoptiondescription()
assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [], 'follower': []}
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]}

View file

@ -271,7 +271,7 @@ class _TiramisuOptionOptionDescription(CommonTiramisuOption):
))
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]):
"""Test if option is an optiondescription"""
option_bag = options_bag[-1]
@ -1415,7 +1415,8 @@ class TiramisuAPI(TiramisuHelp):
if subfunc == 'option':
config_bag = self._config_bag
return TiramisuDispatcherOption(config_bag,
self._orig_config_bags)
self._orig_config_bags,
)
if subfunc in ['forcepermissive', 'unrestraint', 'nowarnings']:
if self._orig_config_bags:
msg = _('do not use unrestraint, nowarnings or forcepermissive together')