update properties in auto test

This commit is contained in:
Emmanuel Garette 2019-02-23 08:01:29 +01:00
parent 0f78e6be77
commit db074a78a5
2 changed files with 27 additions and 60 deletions

View File

@ -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).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).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.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()
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()