tiramisu/tests/test_symlink.py

473 lines
21 KiB
Python
Raw Normal View History

2013-08-24 22:32:54 +02:00
# coding: utf-8
2019-12-24 15:24:20 +01:00
import pytest
2017-07-09 09:49:03 +02:00
from .autopath import do_autopath
2015-07-24 17:54:10 +02:00
do_autopath()
2024-04-24 15:39:17 +02:00
from .config import config_type, get_config, parse_od_get
2013-06-13 22:07:58 +02:00
2023-05-11 15:44:48 +02:00
from tiramisu import BoolOption, StrOption, SymLinkOption, submulti, \
2019-09-01 09:41:53 +02:00
OptionDescription, Leadership, Config, Calculation, calc_value, Params, ParamOption, ParamValue
2023-04-27 11:44:52 +02:00
from tiramisu.error import PropertiesOptionError, ConfigError
2013-06-13 22:07:58 +02:00
from tiramisu.setting import groups, owners
2023-05-11 15:44:48 +02:00
from tiramisu.i18n import _
2013-06-13 22:07:58 +02:00
def return_value():
pass
2013-06-13 22:07:58 +02:00
#____________________________________________________________
def test_symlink_option(config_type):
2013-06-13 22:07:58 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2023-05-11 15:44:48 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])],
)
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert not cfg.option('s1.b').issymlinkoption()
assert cfg.option('c').issymlinkoption()
assert cfg.option('s1.b').type() == 'boolean'
assert cfg.option('c').type() == 'boolean'
assert cfg.option('s1.b').value.get() is False
cfg.option("s1.b").value.set(True)
cfg.option("s1.b").value.set(False)
assert cfg.option('s1.b').value.get() is False
assert cfg.option('c').value.get() is False
cfg.option('s1.b').value.set(True)
assert cfg.option('s1.b').value.get() is True
assert cfg.option('c').value.get() is True
cfg.option('s1.b').value.set(False)
assert cfg.option('s1.b').value.get() is False
assert cfg.option('c').value.get() is False
# assert not list_sessions()
2023-05-11 15:44:48 +02:00
def test_symlink_default(config_type):
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
[linkopt, OptionDescription("s1", "", [boolopt])],
)
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert not cfg.option('s1.b').ismulti()
assert not cfg.option('c').ismulti()
assert not cfg.option('s1.b').issubmulti()
assert not cfg.option('c').issubmulti()
assert not cfg.option('s1.b').default()
assert not cfg.option('c').default()
2023-05-11 15:44:48 +02:00
assert not cfg.option('s1.b').value.default()
assert not cfg.option('c').value.default()
with pytest.raises(ConfigError):
assert not cfg.option('s1.b').defaultmulti()
2023-05-11 15:44:48 +02:00
with pytest.raises(ConfigError):
assert not cfg.option('c').defaultmulti()
2023-05-11 15:44:48 +02:00
cfg.option("s1.b").value.set(True)
assert not cfg.option('s1.b').default()
assert not cfg.option('c').default()
2023-05-11 15:44:48 +02:00
assert not cfg.option('s1.b').value.default()
assert not cfg.option('c').value.default()
## assert not list_sessions()
def test_symlink_default_multi(config_type):
boolopt = BoolOption("b", "", default=[False], default_multi=True, multi=True)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
[linkopt, OptionDescription("s1", "", [boolopt])],
)
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert cfg.option('s1.b').ismulti()
assert cfg.option('c').ismulti()
assert not cfg.option('s1.b').issubmulti()
assert not cfg.option('c').issubmulti()
assert cfg.option('s1.b').default() == [False]
assert cfg.option('c').default() == [False]
2023-05-11 15:44:48 +02:00
assert cfg.option('s1.b').value.default() == [False]
assert cfg.option('c').value.default() == [False]
assert cfg.option('s1.b').defaultmulti()
assert cfg.option('c').defaultmulti()
2023-05-11 15:44:48 +02:00
cfg.option("s1.b").value.set([True])
assert cfg.option('s1.b').default() == [False]
assert cfg.option('c').default() == [False]
2023-05-11 15:44:48 +02:00
assert cfg.option('s1.b').value.default() == [False]
assert cfg.option('c').value.default() == [False]
assert cfg.option('s1.b').defaultmulti()
assert cfg.option('c').defaultmulti()
2023-05-11 15:44:48 +02:00
## assert not list_sessions()
def test_symlink_assign_option(config_type):
2018-04-10 12:33:51 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2018-04-10 12:33:51 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
cfg.option('c').value.set(True)
# assert not list_sessions()
2018-04-10 12:33:51 +02:00
def test_symlink_del_option(config_type):
2018-04-10 12:33:51 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2018-04-10 12:33:51 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
cfg.option('c').value.reset()
# assert not list_sessions()
2018-04-10 12:33:51 +02:00
def test_symlink_addproperties():
2018-04-11 16:36:15 +02:00
boolopt = BoolOption('b', '', default=True, properties=('test',))
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [boolopt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
2023-05-11 15:44:48 +02:00
with pytest.raises(ConfigError):
cfg.option('c').property.add('new')
2023-05-11 15:44:48 +02:00
with pytest.raises(ConfigError):
cfg.option('c').property.reset()
# assert not list_sessions()
def test_symlink_getpermissive():
2018-09-15 22:44:49 +02:00
boolopt = BoolOption('b', '', default=True, properties=('test',))
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [boolopt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
2024-06-20 12:56:27 +02:00
cfg.option('b').permissive.add('perm')
cfg.option('c').permissive.get() == frozenset(['perm'])
# assert not list_sessions()
2018-09-15 22:44:49 +02:00
def test_symlink_addpermissives():
2018-04-11 16:36:15 +02:00
boolopt = BoolOption('b', '', default=True, properties=('test',))
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [boolopt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
2023-05-11 15:44:48 +02:00
with pytest.raises(ConfigError):
cfg.option('c').permissive.set(frozenset(['new']))
2023-05-11 15:44:48 +02:00
with pytest.raises(ConfigError):
cfg.option('c').permissive.reset()
# assert not list_sessions()
def test_symlink_getproperties():
boolopt = BoolOption('b', '', default=True, properties=('test',))
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [boolopt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
assert boolopt.impl_getproperties() == linkopt.impl_getproperties() == {'test'}
# assert boolopt.impl_has_callback() == linkopt.impl_has_callback() == False
# assert not list_sessions()
def test_symlink_getcallback():
2019-09-28 16:32:48 +02:00
boolopt = BoolOption('b', '', Calculation(return_value))
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [boolopt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
#assert boolopt.impl_has_callback() == linkopt.impl_has_callback() == True
#assert boolopt.impl_get_callback() == linkopt.impl_get_callback() == (return_value, None)
# assert boolopt.impl_has_callback() == linkopt.impl_has_callback() == False
# assert not list_sessions()
def test_symlink_requires(config_type):
2013-06-13 22:07:58 +02:00
boolopt = BoolOption('b', '', default=True)
2019-09-01 09:41:53 +02:00
disabled_property = Calculation(calc_value,
Params(ParamValue('disabled'),
kwargs={'condition': ParamOption(boolopt),
'expected': ParamValue(False)}))
stropt = StrOption('s', '', properties=(disabled_property,))
2013-06-13 22:07:58 +02:00
linkopt = SymLinkOption("c", stropt)
od1 = OptionDescription('opt', '', [boolopt, stropt, linkopt])
cfg = Config(od1)
cfg.property.read_write()
cfg = get_config(cfg, config_type)
assert cfg.option('b').value.get() is True
assert cfg.option('s').value.get() is None
assert cfg.option('c').value.get() is None
cfg.option('b').value.set(False)
#
props = []
try:
cfg.option('s').value.get()
except PropertiesOptionError as err:
props = err.proptype
assert props == {'disabled'}
#
props = []
try:
cfg.option('c').value.get()
except PropertiesOptionError as err:
props = err.proptype
assert props == {'disabled'}
# assert not list_sessions()
def test_symlink_multi(config_type):
2013-06-13 22:07:58 +02:00
boolopt = BoolOption("b", "", default=[False], multi=True)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2013-06-13 22:07:58 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert cfg.option('s1.b').value.get() == [False]
assert cfg.option('c').value.get() == [False]
cfg.option('s1.b').value.set([True])
assert cfg.option('s1.b').value.get() == [True]
assert cfg.option('c').value.get() == [True]
cfg.option('s1.b').value.set([False])
assert cfg.option('s1.b').value.get() == [False]
assert cfg.option('c').value.get() == [False]
cfg.option('s1.b').value.set([False, True])
assert cfg.option('s1.b').value.get() == [False, True]
assert cfg.option('c').value.get() == [False, True]
assert boolopt.impl_is_multi() is True
assert linkopt.impl_is_multi() is True
# assert not list_sessions()
def test_symlink_assign(config_type):
2019-07-04 20:43:47 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2019-07-04 20:43:47 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
cfg.option('c').value.set(True)
# assert not list_sessions()
2018-03-19 08:33:53 +01:00
def test_symlink_owner(config_type):
2013-06-13 22:07:58 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2013-06-13 22:07:58 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert cfg.option('s1.b').owner.isdefault()
assert cfg.option('c').owner.isdefault()
cfg.option('s1.b').value.set(True)
assert not cfg.option('s1.b').owner.isdefault()
assert not cfg.option('c').owner.isdefault()
# assert not list_sessions()
def test_symlink_get_information():
2024-06-20 12:56:27 +02:00
boolopt = BoolOption("b", "", default=False, informations={'test': 'test'})
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription('opt', '', [linkopt, boolopt])
cfg = Config(od1)
assert cfg.option('b').information.get('test') == 'test'
assert cfg.option('c').information.get('test') == 'test'
cfg.option('b').information.set('test', 'test2')
assert cfg.option('b').information.get('test') == 'test2'
assert cfg.option('c').information.get('test') == 'test2'
def test_symlink_informations():
2013-06-13 22:07:58 +02:00
boolopt = BoolOption("b", "", default=False)
2024-06-20 12:56:27 +02:00
with pytest.raises(TypeError):
linkopt = SymLinkOption("c", boolopt, informations={'test': 'test'})
2013-06-13 22:07:58 +02:00
linkopt = SymLinkOption("c", boolopt)
2024-06-20 12:56:27 +02:00
od1 = OptionDescription('opt', '', [linkopt, boolopt])
cfg = Config(od1)
with pytest.raises(ConfigError):
cfg.option('c').information.set('test', 'test2')
2013-06-13 22:07:58 +02:00
def test_symlink_leader():
2013-06-13 22:07:58 +02:00
a = StrOption('a', "", multi=True)
ip_admin_eth0 = SymLinkOption('ip_admin_eth0', a)
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "", multi=True)
2020-01-22 20:46:18 +01:00
with pytest.raises(ValueError):
2019-12-24 15:24:20 +01:00
Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
2013-06-13 22:07:58 +02:00
def test_symlink_followers():
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", multi=True)
2024-08-07 08:55:43 +02:00
netmask_admin_eth0 = SymLinkOption('netmask_admin_eth0', ip_admin_eth0)
leader = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
od1 = OptionDescription('opt', '', [leader])
cfg = Config(od1)
assert parse_od_get(cfg.value.get()) == {'ip_admin_eth0.ip_admin_eth0': []}
cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2'])
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).value.get() == 'val2'
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).owner.get() == 'user'
assert parse_od_get(cfg.value.get()) == {
'ip_admin_eth0.ip_admin_eth0': [{'ip_admin_eth0.ip_admin_eth0': 'val1',
'ip_admin_eth0.netmask_admin_eth0': 'val1'},
{'ip_admin_eth0.ip_admin_eth0': 'val2',
'ip_admin_eth0.netmask_admin_eth0': 'val2'}],
}
def test_symlink_leader_default():
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé", ['val1', 'val2'], multi=True)
netmask_admin_eth0 = SymLinkOption('netmask_admin_eth0', ip_admin_eth0)
leader = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
od1 = OptionDescription('opt', '', [leader])
cfg = Config(od1)
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).value.get() == 'val2'
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).owner.isdefault()
assert parse_od_get(cfg.value.get()) == {
'ip_admin_eth0.ip_admin_eth0': [{'ip_admin_eth0.ip_admin_eth0': 'val1',
'ip_admin_eth0.netmask_admin_eth0': 'val1'},
{'ip_admin_eth0.ip_admin_eth0': 'val2',
'ip_admin_eth0.netmask_admin_eth0': 'val2'}],
}
def test_symlink_followers_2():
variable1 = StrOption('variable1', "", multi=True)
variable2 = StrOption('variable2', "", multi=True)
variable3 = SymLinkOption('variable3', variable2)
leader = Leadership('variable1', '', [variable1, variable2, variable3])
od1 = OptionDescription('opt', '', [leader])
cfg = Config(od1)
assert parse_od_get(cfg.value.get()) == {'variable1.variable1': []}
cfg.option('variable1.variable1').value.set(['val1', 'val2'])
cfg.option('variable1.variable2', 0).value.set('ival1')
cfg.option('variable1.variable2', 1).value.set('ival2')
assert cfg.option('variable1.variable3', 1).owner.get() == 'user'
assert cfg.option('variable1.variable3', 1).value.get() == 'ival2'
assert parse_od_get(cfg.value.get()) == {'variable1.variable1': [{'variable1.variable1': 'val1',
'variable1.variable2': 'ival1',
'variable1.variable3': 'ival1'},
{'variable1.variable1': 'val2',
'variable1.variable2': 'ival2',
'variable1.variable3': 'ival2'}],
}
2017-09-17 15:55:32 +02:00
def test_symlink_with_leader(config_type):
2018-04-19 08:19:03 +02:00
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)
2019-02-23 19:06:23 +01:00
interface1 = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
leader = SymLinkOption('leader', ip_admin_eth0)
od1 = OptionDescription('root', '', [interface1, leader])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'ip_admin_eth0.ip_admin_eth0': [], 'leader': []}
cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2'])
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'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}], 'leader': ['val1', 'val2']}
cfg.option('ip_admin_eth0.ip_admin_eth0').value.pop(0)
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
cfg.option('leader').value.pop(0)
# assert not list_sessions()
def test_symlink_with_follower(config_type):
2018-04-19 08:19:03 +02:00
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)
2019-02-23 19:06:23 +01:00
interface1 = Leadership('ip_admin_eth0', '', [ip_admin_eth0, netmask_admin_eth0])
follower = SymLinkOption('follower', netmask_admin_eth0)
od1 = OptionDescription('root', '', [interface1, follower])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
assert not cfg.option('follower').isoptiondescription()
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'ip_admin_eth0.ip_admin_eth0': [], 'follower': []}
cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2'])
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'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.option('ip_admin_eth0.netmask_admin_eth0', 0).owner.get() == 'default'
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).owner.get() == 'default'
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
2023-04-27 11:34:35 +02:00
assert cfg.option('follower', 0).owner.get() == 'default'
assert cfg.option('follower').owner.get() == 'default'
#
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).value.get() == None
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).value.get() == None
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
2023-04-27 11:34:35 +02:00
assert cfg.option('follower', 0).value.get() == None
assert cfg.option('follower').value.get() == [None, None]
#
cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).value.set('val3')
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'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': 'val3'}], 'follower': [None, 'val3']}
#
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).value.get() == None
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).value.get() == 'val3'
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
2023-04-27 11:34:35 +02:00
assert cfg.option('follower', 0).value.get() == None
assert cfg.option('follower').value.get() == [None, 'val3']
#
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 0).owner.get() == 'default'
assert cfg.option('ip_admin_eth0.netmask_admin_eth0', 1).owner.get() == 'user'
2023-04-27 11:44:52 +02:00
with pytest.raises(ConfigError):
2023-04-27 11:34:35 +02:00
assert cfg.option('follower', 0).owner.get() == 'default'
assert cfg.option('follower').owner.get() == 'user'
# assert not list_sessions()
2018-04-19 08:19:03 +02:00
2017-09-17 15:55:32 +02:00
#____________________________________________________________
def test_symlink_dependency():
2017-09-17 15:55:32 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2017-09-17 15:55:32 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
assert cfg.option('s1.b').has_dependency() is False
2024-06-20 12:56:27 +02:00
assert cfg.option('c').has_dependency() is False
assert cfg.option('s1.b').has_dependency(False) is True
2024-06-20 12:56:27 +02:00
assert cfg.option('c').has_dependency(False) is True
# assert not list_sessions()
2018-04-19 08:19:03 +02:00
def test_symlink_makedict(config_type):
2018-04-19 08:19:03 +02:00
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2018-04-19 08:19:03 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'c': False, 's1.b': False}
cfg.option('s1.b').value.set(True)
2024-04-24 15:39:17 +02:00
assert parse_od_get(cfg.value.get()) == {'c': True, 's1.b': True}
# assert not list_sessions()
def test_symlink_list(config_type):
boolopt = BoolOption("b", "", default=False)
linkopt = SymLinkOption("c", boolopt)
od1 = OptionDescription("opt", "",
2024-04-24 15:39:17 +02:00
[linkopt, OptionDescription("s1", "", [boolopt])])
cfg = Config(od1)
cfg = get_config(cfg, config_type)
2024-06-20 12:56:27 +02:00
assert [opt.path() for opt in cfg.list()] == ['c', 's1']
#
2024-04-24 15:39:17 +02:00
assert [opt.path() for opt in cfg.option('s1').list()] == ['s1.b']
# assert not list_sessions()
2023-05-11 15:44:48 +02:00
def test_symlink_submulti():
2023-05-11 15:44:48 +02:00
multi = StrOption('multi', '', multi=submulti)
multi2 = SymLinkOption('multi2', multi)
od1 = OptionDescription('od', '', [multi, multi2])
cfg = Config(od1)
assert cfg.option('multi').ismulti()
assert cfg.option('multi').issubmulti()
assert cfg.option('multi2').ismulti()
assert cfg.option('multi2').issubmulti()
def test_symlink_get_option():
multi = StrOption('multi', '', multi=submulti)
multi2 = SymLinkOption('multi2', multi)
od1 = OptionDescription('od', '', [multi, multi2])
cfg = Config(od1)
option = cfg.option('multi2').option()
assert option.name() == 'multi'
assert option.path() == 'multi'