reset for groupconfig works
This commit is contained in:
@ -195,7 +195,9 @@ def test_get_modified_values():
|
||||
assert not config.option('od.g5').option.issubmulti()
|
||||
config.option('od.g5').value.set('yes')
|
||||
assert to_tuple(config.value.exportation()) == (('od.g5',), (None,), ('yes',), ('user',))
|
||||
config.option('od.g4').value.set(True)
|
||||
config.option('od.g4').value.set(False)
|
||||
assert to_tuple(config.value.exportation()) == (('od.g5', 'od.g4'), (None, None), ('yes', False), ('user', 'user'))
|
||||
config.option('od.g4').value.set(undefined)
|
||||
assert to_tuple(config.value.exportation()) == (('od.g5', 'od.g4'), (None, None), ('yes', True), ('user', 'user'))
|
||||
config.option('od.g4').value.reset()
|
||||
assert to_tuple(config.value.exportation()) == (('od.g5',), (None,), ('yes',), ('user',))
|
||||
|
@ -118,6 +118,12 @@ def test_iter_on_groups():
|
||||
group_type=groups.family):
|
||||
#test StopIteration
|
||||
break
|
||||
result = api.option('creole').list('option',
|
||||
group_type=groups.family)
|
||||
assert list(result) == []
|
||||
result = api.option('creole.general').list('optiondescription',
|
||||
group_type=groups.family)
|
||||
assert list(result) == []
|
||||
|
||||
def test_list_recursive():
|
||||
descr = make_description()
|
||||
@ -130,6 +136,9 @@ def test_list_recursive():
|
||||
result = list(api.option.list(recursive=True))
|
||||
group_names = [res.option.name() for res in result]
|
||||
assert group_names == ['numero_etab', 'nom_machine', 'nombre_interfaces', 'activer_proxy_client', 'mode_conteneur_actif', 'serveur_ntp', 'time_zone', 'ip_admin_eth0', 'netmask_admin_eth0']
|
||||
result = list(api.option.list(recursive=True, type='optiondescription'))
|
||||
group_names = [res.option.name() for res in result]
|
||||
assert group_names == ['general', 'ip_admin_eth0', 'interface1', 'creole']
|
||||
|
||||
|
||||
def test_iter_on_groups_force_permissive():
|
||||
|
@ -7,7 +7,7 @@ from tiramisu.setting import groups, owners
|
||||
from tiramisu import IntOption, StrOption, NetworkOption, NetmaskOption, \
|
||||
OptionDescription, MasterSlaves, Config, GroupConfig, MetaConfig, \
|
||||
Params, ParamOption, ParamValue
|
||||
from tiramisu.error import ConfigError, ConflictError, PropertiesOptionError, SlaveError
|
||||
from tiramisu.error import ConfigError, ConflictError, PropertiesOptionError, SlaveError, APIError
|
||||
|
||||
owners.addowner('meta1')
|
||||
owners.addowner('meta2')
|
||||
@ -286,12 +286,14 @@ def test_not_meta():
|
||||
#raises(ConflictError, "GroupConfig([conf2, conf4], session_id='conf2')")
|
||||
raises(ConflictError, "GroupConfig([conf2, conf2], session_id='conf8')")
|
||||
grp = GroupConfig([conf1, conf2])
|
||||
raises(ConfigError, "grp.option('od1.i1').value.get()")
|
||||
raises(APIError, "grp.option('od1.i1').value.get()")
|
||||
conf1, conf2 = grp.config.list()
|
||||
errors = grp.value.set('od1.i1', 7)
|
||||
assert len(errors) == 0
|
||||
assert grp.config('conf1').option('od1.i1').value.get() == grp.config('conf2').option('od1.i1').value.get() == 7
|
||||
assert grp.config('conf1').option('od1.i1').owner.get() is grp.config('conf2').option('od1.i1').owner.get() is owners.user
|
||||
grp.option('od1.i1').value.reset()
|
||||
assert grp.config('conf1').option('od1.i1').owner.get() is grp.config('conf2').option('od1.i1').owner.get() is owners.default
|
||||
|
||||
|
||||
def test_group_find_firsts():
|
||||
|
Reference in New Issue
Block a user