update properties in auto test
This commit is contained in:
parent
0f78e6be77
commit
db074a78a5
|
@ -196,22 +196,18 @@ def _getproperties(multi, isslave, kwargs):
|
|||
|
||||
def _check_properties(cfg, mcfg, pathread, conf, kwargs, props_permissive, props):
|
||||
if not cfg.unrestraint.option(pathread).option.isslave():
|
||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||
if not kwargs.get('permissive_od', False):
|
||||
assert set(cfg.config(conf).option(pathread).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).option(pathread).property.get()) == set(props)
|
||||
else:
|
||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathread).property.get()")
|
||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathread).property.get()")
|
||||
if not kwargs.get('propertyerror', False):
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread).property.get()) == set(props)
|
||||
else:
|
||||
assert PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread).property.get()"
|
||||
assert PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread).property.get()"
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread).property.get()) == set(props)
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread).property.get()) == set(props)
|
||||
else:
|
||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||
if not kwargs.get('permissive_od', False):
|
||||
assert set(cfg.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).option(pathread, 0).property.get()) == set(props)
|
||||
#
|
||||
|
@ -223,21 +219,11 @@ def _check_properties(cfg, mcfg, pathread, conf, kwargs, props_permissive, props
|
|||
#
|
||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 1).property.get()")
|
||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 1).property.get()")
|
||||
if not kwargs.get('propertyerror', False):
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 0).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 0).property.get()) == set(props)
|
||||
#
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 1).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 1).property.get()) == set(props)
|
||||
else:
|
||||
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread, 0).property.get()")
|
||||
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread, 0).property.get()")
|
||||
#
|
||||
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread, 1).property.get()")
|
||||
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathread, 1).property.get()")
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread, 0).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread, 0).property.get()) == set(props)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 0).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 0).property.get()) == set(props)
|
||||
#
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 1).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).forcepermissive.option(pathread, 1).property.get()) == set(props)
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread, 1).property.get()) == set(props_permissive)
|
||||
assert set(cfg.config(conf).unrestraint.option(pathread, 1).property.get()) == set(props)
|
||||
|
||||
|
@ -362,7 +348,7 @@ def _check_owner(cfg, pathread, conf, kwargs, owner, permissive_owner):
|
|||
|
||||
@autocheck
|
||||
def autocheck_option_multi(cfg, mcfg, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||
if not kwargs.get('permissive_od', False):
|
||||
cfg.option(pathread).option.ismulti()
|
||||
cfg.option(pathread).option.issubmulti()
|
||||
cfg.option(pathread).option.ismaster()
|
||||
|
@ -373,21 +359,11 @@ def autocheck_option_multi(cfg, mcfg, pathread, pathwrite, confread, confwrite,
|
|||
raises(PropertiesOptionError, "cfg.option(pathread).option.ismaster()")
|
||||
raises(PropertiesOptionError, "cfg.option(pathread).option.isslave()")
|
||||
|
||||
if not kwargs.get('propertyerror', False):
|
||||
cfg.forcepermissive.option(pathread).option.ismulti()
|
||||
cfg.forcepermissive.option(pathread).option.issubmulti()
|
||||
cfg.forcepermissive.option(pathread).option.ismaster()
|
||||
cfg.forcepermissive.option(pathread).option.isslave()
|
||||
else:
|
||||
raises(PropertiesOptionError, "cfg.forcepermissive.option(pathread).option.ismulti()")
|
||||
raises(PropertiesOptionError, "cfg.forcepermissive.option(pathread).option.issubmulti()")
|
||||
raises(PropertiesOptionError, "cfg.forcepermissive.option(pathread).option.ismaster()")
|
||||
raises(PropertiesOptionError, "cfg.forcepermissive.option(pathread).option.isslave()")
|
||||
cfg.forcepermissive.option(pathread).option.ismulti()
|
||||
cfg.forcepermissive.option(pathread).option.issubmulti()
|
||||
cfg.forcepermissive.option(pathread).option.ismaster()
|
||||
cfg.forcepermissive.option(pathread).option.isslave()
|
||||
|
||||
cfg.unrestraint.option(pathread).option.ismulti()
|
||||
cfg.unrestraint.option(pathread).option.issubmulti()
|
||||
cfg.unrestraint.option(pathread).option.ismaster()
|
||||
cfg.unrestraint.option(pathread).option.isslave()
|
||||
|
||||
|
||||
@autocheck
|
||||
|
@ -531,25 +507,16 @@ def autocheck_get_value(cfg, mcfg, pathread, pathwrite, confread, confwrite, **k
|
|||
def autocheck_value_slave(cfg, mcfg, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
isslave = cfg.unrestraint.option(pathread).option.isslave()
|
||||
if not isslave:
|
||||
if kwargs.get('propertyerror', False):
|
||||
raises(APIError, "cfg.config(confread).unrestraint.option(pathread).value.len()")
|
||||
return
|
||||
if kwargs.get('propertyerror', False):
|
||||
raises(PropertiesOptionError, "cfg.option(pathread).value.len()")
|
||||
raises(PropertiesOptionError, "cfg.forcepermissive.option(pathread).value.len()")
|
||||
return
|
||||
|
||||
multi = cfg.unrestraint.option(pathread).option.ismulti()
|
||||
submulti_ = cfg.forcepermissive.option(pathread).option.issubmulti()
|
||||
empty_value = kwargs['default']
|
||||
|
||||
def do(conf):
|
||||
if not kwargs.get('permissive', False):
|
||||
length = cfg.config(conf).option(pathread).value.len()
|
||||
assert cfg.config(conf).forcepermissive.option(pathread).value.len() == length
|
||||
else:
|
||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.len()")
|
||||
length = cfg.config(conf).forcepermissive.option(pathread).value.len()
|
||||
length = cfg.config(conf).option(pathread).value.len()
|
||||
assert cfg.config(conf).forcepermissive.option(pathread).value.len() == length
|
||||
assert length == 2
|
||||
do(confread)
|
||||
if confread != confwrite:
|
||||
|
@ -959,7 +926,7 @@ def autocheck_set_owner_permissive(cfg, mcfg, pathread, pathwrite, confread, con
|
|||
@autocheck
|
||||
def autocheck_option(cfg, mcfg, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
expected_name = pathread.split('.')[-1]
|
||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||
if not kwargs.get('permissive_od', False):
|
||||
current_name = cfg.option(pathread).option.name()
|
||||
assert current_name == cfg.forcepermissive.option(pathread).option.name()
|
||||
assert current_name == cfg.unrestraint.option(pathread).option.name()
|
||||
|
@ -1633,20 +1600,20 @@ def make_conf(options, multi, default, default_multi, require, consistency, call
|
|||
|
||||
|
||||
DICT_PATHS = [
|
||||
#test a config without optiondescription
|
||||
# test a config without optiondescription
|
||||
OrderedDict([('first', {}),
|
||||
('second', {'second': {'disabled': True}}),
|
||||
('third', {'third': {'hidden': True}})
|
||||
]),
|
||||
#test a config with two optiondescription
|
||||
]),
|
||||
# test a config with two optiondescription
|
||||
OrderedDict([('subod.subsubod.first', {}),
|
||||
('subod.subsubod.second', {'second': {'disabled': True}}),
|
||||
('subod.subsubod.third', {'third': {'hidden': True}})]),
|
||||
#test a config with masterslaves
|
||||
# test a config with masterslaves
|
||||
OrderedDict([('odmaster.first', {'odmaster': {'master': True}}),
|
||||
('odmaster.second', {'odmaster': {'master': True}, 'second': {'disabled': True, 'slave': True}}),
|
||||
('odmaster.third', {'odmaster': {'master': True}, 'third': {'hidden': True, 'slave': True}})]),
|
||||
#test a config with dynoption
|
||||
# test a config with dynoption
|
||||
OrderedDict([('subod.first', {'subod': {'dyn': True}}),
|
||||
('subod.second', {'second': {'disabled': True}}),
|
||||
('subod.third', {'third': {'hidden': True}}),
|
||||
|
@ -1656,7 +1623,7 @@ DICT_PATHS = [
|
|||
('subodval2.firstval2', None),
|
||||
('subodval2.secondval2', None),
|
||||
('subodval2.thirdval2', None)]),
|
||||
#test a config with dynoption subdir
|
||||
# test a config with dynoption subdir
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True}}),
|
||||
('subod.subsubod.second', {'subsubod': {'dyn': True}, 'second': {'disabled': True}}),
|
||||
('subod.subsubod.third', {'subsubod': {'dyn': True}, 'third': {'hidden': True}}),
|
||||
|
@ -1666,11 +1633,11 @@ DICT_PATHS = [
|
|||
('subod.subsubodval2.firstval2', None),
|
||||
('subod.subsubodval2.secondval2', None),
|
||||
('subod.subsubodval2.thirdval2', None)]),
|
||||
#test a config with hidden subsubod
|
||||
# test a config with hidden subsubod
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'hidden': True}}),
|
||||
('subod.subsubod.second', {'subsubod': {'hidden': True}}),
|
||||
('subod.subsubod.third', {'subsubod': {'hidden': True}})]),
|
||||
#test a config with hidden dyn subsubod
|
||||
# test a config with hidden dyn subsubod
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True, 'hidden': True}}),
|
||||
('subod.subsubod.second', {'subsubod': {'dyn': True, 'hidden': True}}),
|
||||
('subod.subsubod.third', {'subsubod': {'dyn': True, 'hidden': True}}),
|
||||
|
@ -1680,7 +1647,7 @@ DICT_PATHS = [
|
|||
('subod.subsubodval2.firstval2', None),
|
||||
('subod.subsubodval2.secondval2', None),
|
||||
('subod.subsubodval2.thirdval2', None)]),
|
||||
#test a config with dyn subsubod with masterslave
|
||||
# test a config with dyn subsubod with masterslave
|
||||
OrderedDict([('subod.subsubod.first', {'subod': {'dyn': True}, 'subsubod': {'master': True}}),
|
||||
('subod.subsubod.second', {'subod': {'dyn': True}, 'subsubod' : {'master': True}, 'second': {'disabled': True, 'slave': True}}),
|
||||
('subod.subsubod.third', {'subod': {'dyn': True}, 'subsubod': {'master': True}, 'third': {'hidden': True, 'slave': True}}),
|
||||
|
|
|
@ -1358,7 +1358,7 @@ class TiramisuDispatcherOption(TiramisuDispatcher, TiramisuContextOption):
|
|||
subconfig = None
|
||||
else:
|
||||
subconfig, name = self._config_bag.context.cfgimpl_get_home_by_path(path,
|
||||
self._config_bag)
|
||||
self._config_bag)
|
||||
return TiramisuOption(name,
|
||||
path,
|
||||
index,
|
||||
|
|
Loading…
Reference in New Issue