Merge remote-tracking branch 'origin/2.0'
This commit is contained in:
@ -376,3 +376,15 @@ def test_config_od_function():
|
||||
except AttributeError as err:
|
||||
assert str(err) == _('unknown Option {0} in OptionDescription {1}'
|
||||
'').format('impl_get_opt_by_path', descr.impl_getname())
|
||||
|
||||
|
||||
def test_config_subconfig():
|
||||
i1 = IntOption('i1', '')
|
||||
i2 = IntOption('i2', '', default=1)
|
||||
i3 = IntOption('i3', '')
|
||||
i4 = IntOption('i4', '', default=2)
|
||||
od1 = OptionDescription('od1', '', [i1, i2, i3, i4])
|
||||
od2 = OptionDescription('od2', '', [od1])
|
||||
conf1 = Config(od2, name='conf1')
|
||||
conf1
|
||||
raises(ConfigError, "conf2 = Config(od1, name='conf2')")
|
||||
|
@ -25,6 +25,7 @@ def make_description():
|
||||
adresse_serveur_ntp = StrOption('serveur_ntp', "adresse serveur ntp", multi=True)
|
||||
time_zone = ChoiceOption('time_zone', 'fuseau horaire du serveur',
|
||||
('Paris', 'Londres'), 'Paris')
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False, properties=('force_store_value',))
|
||||
|
||||
ip_admin_eth0 = StrOption('ip_admin_eth0', "ip réseau autorisé")
|
||||
netmask_admin_eth0 = StrOption('netmask_admin_eth0', "masque du sous-réseau")
|
||||
@ -36,7 +37,7 @@ def make_description():
|
||||
general = OptionDescription('general', '', [numero_etab, nom_machine,
|
||||
nombre_interfaces, activer_proxy_client,
|
||||
mode_conteneur_actif, mode_conteneur_actif2,
|
||||
adresse_serveur_ntp, time_zone])
|
||||
adresse_serveur_ntp, time_zone, wantref_option])
|
||||
general.impl_set_group_type(groups.family)
|
||||
new = OptionDescription('new', '', [], properties=('hidden',))
|
||||
new.impl_set_group_type(groups.family)
|
||||
@ -54,3 +55,14 @@ def test_duplicate():
|
||||
raises(AssertionError, "_diff_conf(cfg, ncfg)")
|
||||
ncfg.creole.general.numero_etab = 'oui'
|
||||
_diff_conf(cfg, ncfg)
|
||||
|
||||
|
||||
def test_duplicate_force_store_value():
|
||||
descr = make_description()
|
||||
conf = Config(descr)
|
||||
conf2 = Config(descr)
|
||||
assert conf.cfgimpl_get_values()._p_.get_modified_values() == {'creole.general.wantref': ('forced', False)}
|
||||
assert conf2.cfgimpl_get_values()._p_.get_modified_values() == {'creole.general.wantref': ('forced', False)}
|
||||
conf.creole.general.wantref = True
|
||||
assert conf.cfgimpl_get_values()._p_.get_modified_values() == {'creole.general.wantref': ('user', True)}
|
||||
assert conf2.cfgimpl_get_values()._p_.get_modified_values() == {'creole.general.wantref': ('forced', False)}
|
||||
|
@ -231,10 +231,11 @@ def test_meta_unconsistent():
|
||||
i4 = IntOption('i4', '', default=2)
|
||||
od1 = OptionDescription('od1', '', [i1, i2, i3, i4])
|
||||
od2 = OptionDescription('od2', '', [od1])
|
||||
od3 = OptionDescription('od3', '', [od1])
|
||||
conf1 = Config(od2, name='conf1')
|
||||
conf2 = Config(od2, name='conf2')
|
||||
conf3 = Config(od2, name='conf3')
|
||||
conf4 = Config(od1, name='conf4')
|
||||
conf4 = Config(od3, name='conf4')
|
||||
conf3, conf4
|
||||
meta = MetaConfig([conf1, conf2])
|
||||
meta.cfgimpl_get_settings().setowner(owners.meta)
|
||||
|
Reference in New Issue
Block a user