|
|
@ -9,7 +9,7 @@ do_autopath()
|
|
|
|
from tiramisu import Config, MetaConfig, \
|
|
|
|
from tiramisu import Config, MetaConfig, \
|
|
|
|
StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \
|
|
|
|
StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \
|
|
|
|
getapi, submulti, undefined, owners
|
|
|
|
getapi, submulti, undefined, owners
|
|
|
|
from tiramisu.error import PropertiesOptionError, APIError, ConfigError
|
|
|
|
from tiramisu.error import PropertiesOptionError, APIError, ConfigError, SlaveError
|
|
|
|
from tiramisu.api import display_count
|
|
|
|
from tiramisu.api import display_count
|
|
|
|
from collections import OrderedDict
|
|
|
|
from collections import OrderedDict
|
|
|
|
ICON = u'\u2937'
|
|
|
|
ICON = u'\u2937'
|
|
|
@ -77,46 +77,27 @@ def autocheck_option_multi(api, pathread, pathwrite, confread, confwrite, **kwar
|
|
|
|
api.option(pathread).option.issubmulti()
|
|
|
|
api.option(pathread).option.issubmulti()
|
|
|
|
api.option(pathread).option.ismaster()
|
|
|
|
api.option(pathread).option.ismaster()
|
|
|
|
api.option(pathread).option.isslave()
|
|
|
|
api.option(pathread).option.isslave()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).option.ismulti()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).option.issubmulti()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).option.ismaster()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).option.isslave()")
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
if not kwargs.get('propertyerror', False):
|
|
|
|
api.forcepermissive.option(pathread).option.ismulti()
|
|
|
|
api.forcepermissive.option(pathread).option.ismulti()
|
|
|
|
api.forcepermissive.option(pathread).option.issubmulti()
|
|
|
|
api.forcepermissive.option(pathread).option.issubmulti()
|
|
|
|
api.forcepermissive.option(pathread).option.ismaster()
|
|
|
|
api.forcepermissive.option(pathread).option.ismaster()
|
|
|
|
api.forcepermissive.option(pathread).option.isslave()
|
|
|
|
api.forcepermissive.option(pathread).option.isslave()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismulti()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.issubmulti()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismaster()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.isslave()")
|
|
|
|
#
|
|
|
|
#
|
|
|
|
api.unrestraint.option(pathread).option.ismulti()
|
|
|
|
api.unrestraint.option(pathread).option.ismulti()
|
|
|
|
api.unrestraint.option(pathread).option.issubmulti()
|
|
|
|
api.unrestraint.option(pathread).option.issubmulti()
|
|
|
|
api.unrestraint.option(pathread).option.ismaster()
|
|
|
|
api.unrestraint.option(pathread).option.ismaster()
|
|
|
|
api.unrestraint.option(pathread).option.isslave()
|
|
|
|
api.unrestraint.option(pathread).option.isslave()
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
#raises(PropertiesOptionError, "api.option(pathread).option.ismulti()")
|
|
|
|
|
|
|
|
#raises(PropertiesOptionError, "api.option(pathread).option.issubmulti()")
|
|
|
|
|
|
|
|
#raises(PropertiesOptionError, "api.option(pathread).option.ismaster()")
|
|
|
|
|
|
|
|
#raises(PropertiesOptionError, "api.option(pathread).option.isslave()")
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
api.forcepermissive.option(pathread).option.ismulti()
|
|
|
|
|
|
|
|
api.forcepermissive.option(pathread).option.issubmulti()
|
|
|
|
|
|
|
|
api.forcepermissive.option(pathread).option.ismaster()
|
|
|
|
|
|
|
|
api.forcepermissive.option(pathread).option.isslave()
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
api.unrestraint.option(pathread).option.ismulti()
|
|
|
|
|
|
|
|
api.unrestraint.option(pathread).option.issubmulti()
|
|
|
|
|
|
|
|
api.unrestraint.option(pathread).option.ismaster()
|
|
|
|
|
|
|
|
api.unrestraint.option(pathread).option.isslave()
|
|
|
|
|
|
|
|
#else:
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.ismulti()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.issubmulti()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.ismaster()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.isslave()")
|
|
|
|
|
|
|
|
# #
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismulti()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.issubmulti()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.ismaster()")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.isslave()")
|
|
|
|
|
|
|
|
# #
|
|
|
|
|
|
|
|
# api.unrestraint.option(pathread).option.ismulti()
|
|
|
|
|
|
|
|
# api.unrestraint.option(pathread).option.issubmulti()
|
|
|
|
|
|
|
|
# api.unrestraint.option(pathread).option.ismaster()
|
|
|
|
|
|
|
|
# api.unrestraint.option(pathread).option.isslave()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -134,17 +115,17 @@ def autocheck_default_owner(api, pathread, pathwrite, confread, confwrite, **kwa
|
|
|
|
assert api.config(conf).option(pathread).owner.isdefault()
|
|
|
|
assert api.config(conf).option(pathread).owner.isdefault()
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
#raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == 'default'
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == 'default'
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.isdefault()
|
|
|
|
#else:
|
|
|
|
else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
|
|
|
|
# #
|
|
|
|
#
|
|
|
|
# raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
|
|
|
|
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
|
|
|
@ -166,8 +147,8 @@ def autocheck_default_owner(api, pathread, pathwrite, confread, confwrite, **kwa
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault()")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault()")
|
|
|
|
|
|
|
|
|
|
|
|
# unrestraint is not allowed
|
|
|
|
# unrestraint is not allowed
|
|
|
|
#raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.get()")
|
|
|
|
#raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
raises(APIError, "api.unrestraint.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
do(confread)
|
|
|
|
do(confread)
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
do(confwrite)
|
|
|
|
do(confwrite)
|
|
|
@ -256,6 +237,7 @@ def _set_value(api, pathwrite, conf, **kwargs):
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set([first_value[0]])")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set([first_value[0]])")
|
|
|
|
raises(PropertiesOptionError,
|
|
|
|
raises(PropertiesOptionError,
|
|
|
|
"api.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])")
|
|
|
|
"api.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])")
|
|
|
|
|
|
|
|
if len(first_value) > 1:
|
|
|
|
raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value[1])")
|
|
|
|
raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value[1])")
|
|
|
|
elif isslave:
|
|
|
|
elif isslave:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
@ -287,7 +269,7 @@ def _set_value(api, pathwrite, conf, **kwargs):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
#raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
#FIXME raises(APIError, "api.unrestraint.config(conf).option(pathwrite).value.set(first_value)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -418,7 +400,8 @@ def autocheck_get_value(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
def autocheck_value_slave(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
def autocheck_value_slave(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
isslave = api.unrestraint.option(pathread).option.isslave()
|
|
|
|
isslave = api.unrestraint.option(pathread).option.isslave()
|
|
|
|
if not isslave:
|
|
|
|
if not isslave:
|
|
|
|
#FIXME raises(APIError, "api.config(confread).option(pathread).value.len()")
|
|
|
|
if kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
raises(APIError, "api.config(confread).option(pathread).value.len()")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
if kwargs.get('propertyerror', False):
|
|
|
|
if kwargs.get('propertyerror', False):
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).value.len()")
|
|
|
|
raises(PropertiesOptionError, "api.option(pathread).value.len()")
|
|
|
@ -453,14 +436,14 @@ def autocheck_value_slave(api, pathread, pathwrite, confread, confwrite, **kwarg
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
value = SUBLIST_FIRST_VALUE[0]
|
|
|
|
value = SUBLIST_FIRST_VALUE[0]
|
|
|
|
|
|
|
|
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).value.get()")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).value.get()")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).value.set(value)")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).value.set(value)")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).value.reset()")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).value.reset()")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.get()")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).owner.get()")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.isdefault()")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).owner.isdefault()")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).property.get()")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).property.get()")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).owner.set('new_user')")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).owner.set('new_user')")
|
|
|
|
raises(IndexError, "api.forcepermissive.option(pathread, length).property.set(('prop',))")
|
|
|
|
raises(SlaveError, "api.forcepermissive.option(pathread, length).property.add('prop')")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -488,12 +471,12 @@ def autocheck_reset_value(api, pathread, pathwrite, confread, confwrite, **kwarg
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
api.config(confwrite).option(pathwrite).value.reset()
|
|
|
|
api.config(confwrite).option(pathwrite).value.reset()
|
|
|
|
#else:
|
|
|
|
#else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).value.reset()")
|
|
|
|
#FIXME raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).value.reset()")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
api.config(confwrite).option(pathwrite, 0).value.reset()
|
|
|
|
api.config(confwrite).option(pathwrite, 0).value.reset()
|
|
|
|
#else:
|
|
|
|
#else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite, 0).value.reset()")
|
|
|
|
#FIXME raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite, 0).value.reset()")
|
|
|
|
|
|
|
|
|
|
|
|
# get value after reset value without permissive
|
|
|
|
# get value after reset value without permissive
|
|
|
|
def do(conf):
|
|
|
|
def do(conf):
|
|
|
@ -606,7 +589,6 @@ def autocheck_reset_value_permissive(api, pathread, pathwrite, confread, confwri
|
|
|
|
# check if is a multi, a master or a slave
|
|
|
|
# check if is a multi, a master or a slave
|
|
|
|
isslave = api.unrestraint.option(pathread).option.isslave()
|
|
|
|
isslave = api.unrestraint.option(pathread).option.isslave()
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
# reset value with permissive
|
|
|
|
# reset value with permissive
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not isslave:
|
|
|
|
if not isslave:
|
|
|
@ -618,14 +600,14 @@ def autocheck_reset_value_permissive(api, pathread, pathwrite, confread, confwri
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).value.reset()
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).value.reset()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
api.forcepermissive.option(pathwrite, 1).value.reset()
|
|
|
|
api.forcepermissive.option(pathwrite, 1).value.reset()
|
|
|
|
#else:
|
|
|
|
#FIXME else:
|
|
|
|
# if not isslave:
|
|
|
|
# if not isslave:
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(pathwrite).value.reset()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(pathwrite).value.reset()")
|
|
|
|
# else:
|
|
|
|
# else:
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathwrite, 1).value.reset()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathwrite, 1).value.reset()")
|
|
|
|
_autocheck_default_value(api, pathread, confread, **kwargs)
|
|
|
|
_autocheck_default_value(api, pathread, confread, **kwargs)
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
_autocheck_default_value(api, pathread, confwrite, **kwargs)
|
|
|
|
_autocheck_default_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -636,16 +618,10 @@ def autocheck_display(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
make_dict = kwargs['make_dict']
|
|
|
|
make_dict = kwargs['make_dict']
|
|
|
|
make_dict_value = kwargs['make_dict_value']
|
|
|
|
make_dict_value = kwargs['make_dict_value']
|
|
|
|
#print('--------')
|
|
|
|
|
|
|
|
#print(make_dict)
|
|
|
|
|
|
|
|
#print(api.config(confread).config.make_dict())
|
|
|
|
|
|
|
|
assert api.config(confread).option.make_dict() == make_dict
|
|
|
|
assert api.config(confread).option.make_dict() == make_dict
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
assert(api.config(confwrite).option.make_dict()) == make_dict
|
|
|
|
assert(api.config(confwrite).option.make_dict()) == make_dict
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
#print('--')
|
|
|
|
|
|
|
|
#print(make_dict_value)
|
|
|
|
|
|
|
|
#print(api.config(confread).config.make_dict())
|
|
|
|
|
|
|
|
assert api.config(confread).option.make_dict() == make_dict_value
|
|
|
|
assert api.config(confread).option.make_dict() == make_dict_value
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
assert(api.config(confwrite).option.make_dict()) == make_dict_value
|
|
|
|
assert(api.config(confwrite).option.make_dict()) == make_dict_value
|
|
|
@ -666,29 +642,52 @@ def _getproperties(multi, isslave, kwargs):
|
|
|
|
return default_props, frozenset(properties)
|
|
|
|
return default_props, frozenset(properties)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _check_default_properties(api, pathread, conf, kwargs, props_permissive, props):
|
|
|
|
def _check_properties(api, pathread, conf, kwargs, props_permissive, props):
|
|
|
|
if not api.unrestraint.option(pathread).option.isslave():
|
|
|
|
if not api.unrestraint.option(pathread).option.isslave():
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
assert set(api.config(conf).option(pathread).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.config(conf).option(pathread).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.config(conf).forcepermissive.option(pathread).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.config(conf).option(pathread).property.get()) == set(props)
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
else:
|
|
|
|
#raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
|
|
|
|
|
|
|
|
if kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread).property.get()) == set(props)
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread).property.get()) == set(props)
|
|
|
|
#else:
|
|
|
|
else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
|
|
|
|
assert(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).property.get()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).property.get()")
|
|
|
|
assert(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).property.get()")
|
|
|
|
#raises(APIError, "api.unrestraint.option(pathread).property.get()")
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread).property.get()) == set(props)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
assert set(api.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.config(conf).option(pathread, 0).property.get()) == set(props)
|
|
|
|
|
|
|
|
#
|
|
|
|
assert set(api.config(conf).option(pathread, 1).property.get()) == set(props_permissive)
|
|
|
|
assert set(api.config(conf).option(pathread, 1).property.get()) == set(props_permissive)
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
assert set(api.config(conf).option(pathread, 1).property.get()) == set(props)
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).property.get()")
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 0).property.get()) == set(props)
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 1).property.get()) == set(props)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).property.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).property.get()")
|
|
|
|
raises(APIError, "api.unrestraint.option(pathread, 0).property.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread, 0).property.get()")
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread, 1).property.get()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread, 1).property.get()")
|
|
|
|
|
|
|
|
if kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 0).property.get()) == set(props)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 1).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.forcepermissive.config(conf).option(pathread, 1).property.get()) == set(props)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).property.get()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 0).property.get()")
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 1).property.get()")
|
|
|
|
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread, 1).property.get()")
|
|
|
|
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread, 0).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread, 0).property.get()) == set(props)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread, 1).property.get()) == set(props_permissive)
|
|
|
|
|
|
|
|
assert set(api.unrestraint.config(conf).option(pathread, 1).property.get()) == set(props)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -701,21 +700,17 @@ def autocheck_property(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
default_props, properties = _getproperties(multi, isslave, kwargs)
|
|
|
|
default_props, properties = _getproperties(multi, isslave, kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
_check_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
if confread != confwrite:
|
|
|
|
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
|
|
|
|
|
|
|
|
# set properties without permissive
|
|
|
|
# set properties without permissive
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
for prop in properties:
|
|
|
|
for prop in properties:
|
|
|
|
api.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
api.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
#else:
|
|
|
|
_check_properties(api, pathread, confread, kwargs, properties, properties)
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.set(properties)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, properties, default_props)
|
|
|
|
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, properties, default_props)
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, properties, properties)
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
raises(ConfigError, "api.config(confread).option(pathread).property.set(properties)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
def _property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
@ -736,28 +731,19 @@ def _property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs
|
|
|
|
default_props.extend(extra_properties)
|
|
|
|
default_props.extend(extra_properties)
|
|
|
|
default_props, properties = _getproperties(multi, isslave, kwargs)
|
|
|
|
default_props, properties = _getproperties(multi, isslave, kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
_check_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
|
|
|
|
|
|
|
|
# set properties with permissive
|
|
|
|
# set properties with permissive
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
for prop in properties:
|
|
|
|
for prop in properties:
|
|
|
|
api.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
api.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
api.unrestraint.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
for prop in properties:
|
|
|
|
|
|
|
|
#raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.add(prop)")
|
|
|
|
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).property.add(prop)
|
|
|
|
|
|
|
|
#else:
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.set(properties)")
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(confwrite).option(pathwrite).property.set(properties)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, properties, properties)
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, properties, properties)
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, properties, properties)
|
|
|
|
_check_properties(api, pathread, confread, kwargs, properties, properties)
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
raises(ConfigError, "api.config(confread).option(pathwrite).property.set(properties)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -777,16 +763,11 @@ def autocheck_reset_property(api, pathread, pathwrite, confread, confwrite, **kw
|
|
|
|
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
# reset properties without permissive
|
|
|
|
# reset properties without permissive
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
api.config(confwrite).option(pathwrite).property.reset()
|
|
|
|
api.config(confwrite).option(pathwrite).property.reset()
|
|
|
|
#else:
|
|
|
|
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).property.reset()")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, default_props, properties)
|
|
|
|
_check_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, default_props, properties)
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
raises(ConfigError, "api.config(confread).option(pathread).property.reset()")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -798,25 +779,19 @@ def autocheck_reset_property_permissive(api, pathread, pathwrite, confread, conf
|
|
|
|
|
|
|
|
|
|
|
|
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
_property_permissive(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
# reset properties with permissive
|
|
|
|
|
|
|
|
raises(APIError, "api.unrestraint.option(pathwrite).property.set(properties)")
|
|
|
|
|
|
|
|
#raises(APIError, "api.unrestraint.option(pathwrite).property.reset()")
|
|
|
|
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
|
|
|
|
for prop in properties:
|
|
|
|
for prop in properties:
|
|
|
|
api.forcepermissive.option(pathwrite).property.add(prop)
|
|
|
|
api.forcepermissive.option(pathwrite).property.add(prop)
|
|
|
|
api.forcepermissive.option(pathwrite).property.reset()
|
|
|
|
api.forcepermissive.option(pathwrite).property.reset()
|
|
|
|
elif kwargs.get('permissive', False):
|
|
|
|
|
|
|
|
api.forcepermissive.option(pathwrite).property.reset()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_check_default_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
_check_properties(api, pathread, confwrite, kwargs, default_props, default_props)
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
_check_default_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
_check_properties(api, pathread, confread, kwargs, default_props, default_props)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
|
def autocheck_context_owner(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
def autocheck_context_owner(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
owner = api.owner.get()
|
|
|
|
owner = api.owner.get()
|
|
|
|
assert owner == OWNER
|
|
|
|
assert owner == kwargs['owner']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _check_owner(api, pathread, conf, kwargs, owner, permissive_owner):
|
|
|
|
def _check_owner(api, pathread, conf, kwargs, owner, permissive_owner):
|
|
|
@ -826,11 +801,11 @@ def _check_owner(api, pathread, conf, kwargs, owner, permissive_owner):
|
|
|
|
assert api.config(conf).option(pathread).owner.get() == owner
|
|
|
|
assert api.config(conf).option(pathread).owner.get() == owner
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == owner
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == owner
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
#raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == permissive_owner
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread).owner.get() == permissive_owner
|
|
|
|
#else:
|
|
|
|
else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.config(conf).option(pathread).owner.get()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
|
|
|
|
raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.get()")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
|
|
|
|
assert api.config(conf).option(pathread, 0).owner.get() == 'default'
|
|
|
@ -852,9 +827,9 @@ def autocheck_owner_with_value(api, pathread, pathwrite, confread, confwrite, **
|
|
|
|
"""value is now changed, check owner in this case
|
|
|
|
"""value is now changed, check owner in this case
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
_set_value(api, pathwrite, confwrite, **kwargs)
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, OWNER, OWNER)
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, kwargs['owner'], kwargs['owner'])
|
|
|
|
if confread != confwrite:
|
|
|
|
if confread != confwrite:
|
|
|
|
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
|
|
|
|
_check_owner(api, pathread, confread, kwargs, kwargs['owner'], kwargs['owner'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -868,7 +843,7 @@ def autocheck_default_owner_with_value(api, pathread, pathwrite, confread, confw
|
|
|
|
assert api.config(confwrite).option(pathread).owner.isdefault() is False
|
|
|
|
assert api.config(confwrite).option(pathread).owner.isdefault() is False
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
assert api.config(confread).option(pathread).owner.isdefault() is False
|
|
|
|
assert api.config(confread).option(pathread).owner.isdefault() is False
|
|
|
|
#else:
|
|
|
|
#FIXME else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathread).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathread).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confread).option(pathread).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confread).option(pathread).owner.isdefault()")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -878,9 +853,9 @@ def autocheck_default_owner_with_value(api, pathread, pathwrite, confread, confw
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
assert api.config(confread).option(pathread, 0).owner.isdefault() is True
|
|
|
|
assert api.config(confread).option(pathread, 0).owner.isdefault() is True
|
|
|
|
assert api.config(confread).option(pathread, 1).owner.isdefault() is False
|
|
|
|
assert api.config(confread).option(pathread, 1).owner.isdefault() is False
|
|
|
|
else:
|
|
|
|
#FIXME else:
|
|
|
|
raises(PropertiesOptionError, "api.config(confwrite).option(pathread, 0).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathread, 0).owner.isdefault()")
|
|
|
|
raises(PropertiesOptionError, "api.config(confread).option(pathread, 0).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confread).option(pathread, 0).owner.isdefault()")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -898,7 +873,7 @@ def autocheck_default_owner_with_value_permissive(api, pathread, pathwrite, conf
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault() is True
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread, 0).owner.isdefault() is True
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread, 1).owner.isdefault() is False
|
|
|
|
assert api.forcepermissive.config(conf).option(pathread, 1).owner.isdefault() is False
|
|
|
|
#else:
|
|
|
|
#FIXME else:
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.config(conf).option(pathread).owner.isdefault()")
|
|
|
|
do(confwrite)
|
|
|
|
do(confwrite)
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
@ -929,17 +904,17 @@ def autocheck_set_owner(api, pathread, pathwrite, confread, confwrite, **kwargs)
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('default')")
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('default')")
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('forced')")
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('forced')")
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('meta')")
|
|
|
|
raises(ConfigError, "api.config(confwrite).option(pathwrite).owner.set('meta')")
|
|
|
|
#else:
|
|
|
|
#FIXME else:
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).owner.set('new_user')")
|
|
|
|
# raises(PropertiesOptionError, "api.config(confwrite).option(pathwrite).owner.set('new_user')")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
api.option(pathwrite, 1).owner.set('new_user')
|
|
|
|
api.option(pathwrite, 1).owner.set('new_user')
|
|
|
|
else:
|
|
|
|
#FIXME else:
|
|
|
|
raises(PropertiesOptionError, "api.option(pathwrite, 1).owner.set('new_user')")
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathwrite, 1).owner.set('new_user')")
|
|
|
|
|
|
|
|
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, owners.new_user, OWNER)
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, owners.new_user, kwargs['owner'])
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
|
|
|
|
_check_owner(api, pathread, confread, kwargs, owners.new_user, owners.meta)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -954,7 +929,7 @@ def autocheck_set_owner_permissive(api, pathread, pathwrite, confread, confwrite
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')
|
|
|
|
api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
api.forcepermissive.option(pathwrite, 1).owner.set('new_user1')
|
|
|
|
api.forcepermissive.option(pathwrite, 1).owner.set('new_user1')
|
|
|
|
#else:
|
|
|
|
#FIXME else:
|
|
|
|
# if not isslave:
|
|
|
|
# if not isslave:
|
|
|
|
# raises(PropertiesOptionError,
|
|
|
|
# raises(PropertiesOptionError,
|
|
|
|
# "api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')")
|
|
|
|
# "api.forcepermissive.config(confwrite).option(pathwrite).owner.set('new_user1')")
|
|
|
@ -964,40 +939,40 @@ def autocheck_set_owner_permissive(api, pathread, pathwrite, confread, confwrite
|
|
|
|
|
|
|
|
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, 'new_user1', 'new_user1')
|
|
|
|
_check_owner(api, pathread, confwrite, kwargs, 'new_user1', 'new_user1')
|
|
|
|
if confwrite != confread:
|
|
|
|
if confwrite != confread:
|
|
|
|
_check_owner(api, pathread, confread, kwargs, owners.meta, owners.meta)
|
|
|
|
_check_owner(api, pathread, confread, kwargs, 'new_user1', 'new_user1')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
#FIXME @autocheck
|
|
|
|
def autocheck_option(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
#def autocheck_option(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
|
|
|
expected_name = pathread.split('.')[-1]
|
|
|
|
# expected_name = pathread.split('.')[-1]
|
|
|
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
# if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
|
|
|
current_name = api.option(pathread).option.name
|
|
|
|
# current_name = api.option(pathread).option.name
|
|
|
|
assert current_name == api.forcepermissive.option(pathread).option.name
|
|
|
|
# assert current_name == api.forcepermissive.option(pathread).option.name
|
|
|
|
assert current_name == api.unrestraint.option(pathread).option.name
|
|
|
|
# assert current_name == api.unrestraint.option(pathread).option.name
|
|
|
|
doc = api.option(pathread).option.doc()
|
|
|
|
# doc = api.option(pathread).option.doc()
|
|
|
|
assert doc == api.forcepermissive.option(pathread).option.doc()
|
|
|
|
# assert doc == api.forcepermissive.option(pathread).option.doc()
|
|
|
|
assert doc == api.unrestraint.option(pathread).option.doc()
|
|
|
|
# assert doc == api.unrestraint.option(pathread).option.doc()
|
|
|
|
elif not kwargs.get('propertyerror', False):
|
|
|
|
# elif not kwargs.get('propertyerror', False):
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.name")
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.name")
|
|
|
|
current_name = api.forcepermissive.option(pathread).option.name
|
|
|
|
# current_name = api.forcepermissive.option(pathread).option.name
|
|
|
|
assert current_name == api.unrestraint.option(pathread).option.name
|
|
|
|
# assert current_name == api.unrestraint.option(pathread).option.name
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
|
|
|
|
doc = api.forcepermissive.option(pathread).option.doc()
|
|
|
|
# doc = api.forcepermissive.option(pathread).option.doc()
|
|
|
|
assert doc == api.unrestraint.option(pathread).option.doc()
|
|
|
|
# assert doc == api.unrestraint.option(pathread).option.doc()
|
|
|
|
else:
|
|
|
|
# else:
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.name")
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.name")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.name")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.name")
|
|
|
|
current_name = api.unrestraint.option(pathread).option.name
|
|
|
|
# current_name = api.unrestraint.option(pathread).option.name
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
|
|
|
|
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.doc()")
|
|
|
|
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.doc()")
|
|
|
|
doc = api.unrestraint.option(pathread).option.doc()
|
|
|
|
# doc = api.unrestraint.option(pathread).option.doc()
|
|
|
|
assert current_name == expected_name
|
|
|
|
# assert current_name == expected_name
|
|
|
|
if expected_name.endswith('val1') or expected_name.endswith('val2'):
|
|
|
|
# if expected_name.endswith('val1') or expected_name.endswith('val2'):
|
|
|
|
expected_name = expected_name[:-4]
|
|
|
|
# expected_name = expected_name[:-4]
|
|
|
|
if kwargs['symlink']:
|
|
|
|
# if kwargs['symlink']:
|
|
|
|
assert doc == "{}'s option link".format(expected_name)
|
|
|
|
# assert doc == "{}'s option link".format(expected_name)
|
|
|
|
else:
|
|
|
|
# else:
|
|
|
|
assert doc == "{}'s option".format(expected_name)
|
|
|
|
# assert doc == "{}'s option".format(expected_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@autocheck
|
|
|
|
@autocheck
|
|
|
@ -1336,6 +1311,12 @@ def check_all(cfg, paths, path, meta, multi, default, default_multi, require, co
|
|
|
|
weakrefs.append(weakref.ref(cfg))
|
|
|
|
weakrefs.append(weakref.ref(cfg))
|
|
|
|
api = getapi(ncfg)
|
|
|
|
api = getapi(ncfg)
|
|
|
|
ckwargs = copy(kwargs)
|
|
|
|
ckwargs = copy(kwargs)
|
|
|
|
|
|
|
|
if meta:
|
|
|
|
|
|
|
|
api.owner.set('meta')
|
|
|
|
|
|
|
|
ckwargs['owner'] = owners.meta
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
ckwargs['owner'] = OWNER
|
|
|
|
|
|
|
|
|
|
|
|
if api.unrestraint.option(path).option.isslave():
|
|
|
|
if api.unrestraint.option(path).option.isslave():
|
|
|
|
dirname = path.rsplit('.', 1)[0]
|
|
|
|
dirname = path.rsplit('.', 1)[0]
|
|
|
|
master_path = dirname + '.first'
|
|
|
|
master_path = dirname + '.first'
|
|
|
@ -1469,6 +1450,8 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
|
|
|
|
if in_master and symlink:
|
|
|
|
if in_master and symlink:
|
|
|
|
return None, None, None
|
|
|
|
return None, None, None
|
|
|
|
if option_infos is not None:
|
|
|
|
if option_infos is not None:
|
|
|
|
|
|
|
|
if require:
|
|
|
|
|
|
|
|
return None, None, None
|
|
|
|
for prop in PROPERTIES:
|
|
|
|
for prop in PROPERTIES:
|
|
|
|
if option_infos.get(prop, False) is True:
|
|
|
|
if option_infos.get(prop, False) is True:
|
|
|
|
if not require:
|
|
|
|
if not require:
|
|
|
@ -1537,7 +1520,7 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
|
|
|
|
gopt = goptions[1]
|
|
|
|
gopt = goptions[1]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
gopt = goptions[0]
|
|
|
|
gopt = goptions[0]
|
|
|
|
obj.impl_add_consistency('not_equal', gopt, warnings_only=True)
|
|
|
|
obj.impl_add_consistency('not_equal', gopt, warnings_only=True, transitive=False)
|
|
|
|
return obj, objcall, sobj
|
|
|
|
return obj, objcall, sobj
|
|
|
|
|
|
|
|
|
|
|
|
def make_optiondescriptions(path, collected):
|
|
|
|
def make_optiondescriptions(path, collected):
|
|
|
@ -1643,63 +1626,63 @@ def make_conf(options, meta, multi, default, default_multi, require, consistency
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DICT_PATHS = [
|
|
|
|
DICT_PATHS = [
|
|
|
|
#test a config without optiondescription
|
|
|
|
##test a config without optiondescription
|
|
|
|
OrderedDict([('first', {}),
|
|
|
|
#OrderedDict([('first', {}),
|
|
|
|
('second', {'second': {'disabled': True}}),
|
|
|
|
# ('second', {'second': {'disabled': True}}),
|
|
|
|
('third', {'third': {'hidden': True}})
|
|
|
|
# ('third', {'third': {'hidden': True}})
|
|
|
|
]),
|
|
|
|
# ]),
|
|
|
|
#test a config with two optiondescription
|
|
|
|
##test a config with two optiondescription
|
|
|
|
OrderedDict([('subod.subsubod.first', {}),
|
|
|
|
#OrderedDict([('subod.subsubod.first', {}),
|
|
|
|
('subod.subsubod.second', {'second': {'disabled': True}}),
|
|
|
|
# ('subod.subsubod.second', {'second': {'disabled': True}}),
|
|
|
|
('subod.subsubod.third', {'third': {'hidden': True}})]),
|
|
|
|
# ('subod.subsubod.third', {'third': {'hidden': True}})]),
|
|
|
|
#test a config with masterslaves
|
|
|
|
##test a config with masterslaves
|
|
|
|
OrderedDict([('odmaster.first', {'odmaster': {'master': True}}),
|
|
|
|
#OrderedDict([('odmaster.first', {'odmaster': {'master': True}}),
|
|
|
|
('odmaster.second', {'odmaster': {'master': True}, 'second': {'disabled': True, 'slave': True}}),
|
|
|
|
# ('odmaster.second', {'odmaster': {'master': True}, 'second': {'disabled': True, 'slave': True}}),
|
|
|
|
('odmaster.third', {'odmaster': {'master': True}, 'third': {'hidden': 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}}),
|
|
|
|
#OrderedDict([('subod.first', {'subod': {'dyn': True}}),
|
|
|
|
('subod.second', {'second': {'disabled': True}}),
|
|
|
|
# ('subod.second', {'second': {'disabled': True}}),
|
|
|
|
('subod.third', {'third': {'hidden': True}}),
|
|
|
|
# ('subod.third', {'third': {'hidden': True}}),
|
|
|
|
('subodval1.firstval1', None),
|
|
|
|
# ('subodval1.firstval1', None),
|
|
|
|
('subodval1.secondval1', None),
|
|
|
|
# ('subodval1.secondval1', None),
|
|
|
|
('subodval1.thirdval1', None),
|
|
|
|
# ('subodval1.thirdval1', None),
|
|
|
|
('subodval2.firstval2', None),
|
|
|
|
# ('subodval2.firstval2', None),
|
|
|
|
('subodval2.secondval2', None),
|
|
|
|
# ('subodval2.secondval2', None),
|
|
|
|
('subodval2.thirdval2', None)]),
|
|
|
|
# ('subodval2.thirdval2', None)]),
|
|
|
|
#test a config with dynoption subdir
|
|
|
|
##test a config with dynoption subdir
|
|
|
|
OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True}}),
|
|
|
|
#OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True}}),
|
|
|
|
('subod.subsubod.second', {'subsubod': {'dyn': True}, 'second': {'disabled': True}}),
|
|
|
|
# ('subod.subsubod.second', {'subsubod': {'dyn': True}, 'second': {'disabled': True}}),
|
|
|
|
('subod.subsubod.third', {'subsubod': {'dyn': True}, 'third': {'hidden': True}}),
|
|
|
|
# ('subod.subsubod.third', {'subsubod': {'dyn': True}, 'third': {'hidden': True}}),
|
|
|
|
('subod.subsubodval1.firstval1', None),
|
|
|
|
# ('subod.subsubodval1.firstval1', None),
|
|
|
|
('subod.subsubodval1.secondval1', None),
|
|
|
|
# ('subod.subsubodval1.secondval1', None),
|
|
|
|
('subod.subsubodval1.thirdval1', None),
|
|
|
|
# ('subod.subsubodval1.thirdval1', None),
|
|
|
|
('subod.subsubodval2.firstval2', None),
|
|
|
|
# ('subod.subsubodval2.firstval2', None),
|
|
|
|
('subod.subsubodval2.secondval2', None),
|
|
|
|
# ('subod.subsubodval2.secondval2', None),
|
|
|
|
('subod.subsubodval2.thirdval2', None)]),
|
|
|
|
# ('subod.subsubodval2.thirdval2', None)]),
|
|
|
|
#test a config with hidden subsubod
|
|
|
|
##test a config with hidden subsubod
|
|
|
|
OrderedDict([('subod.subsubod.first', {'subsubod': {'hidden': True}}),
|
|
|
|
OrderedDict([('subod.subsubod.first', {'subsubod': {'hidden': True}}),
|
|
|
|
('subod.subsubod.second', {'subsubod': {'hidden': True}}),
|
|
|
|
('subod.subsubod.second', {'subsubod': {'hidden': True}}),
|
|
|
|
('subod.subsubod.third', {'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}}),
|
|
|
|
#OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True, 'hidden': True}}),
|
|
|
|
('subod.subsubod.second', {'subsubod': {'dyn': True, 'hidden': True}}),
|
|
|
|
# ('subod.subsubod.second', {'subsubod': {'dyn': True, 'hidden': True}}),
|
|
|
|
('subod.subsubod.third', {'subsubod': {'dyn': True, 'hidden': True}}),
|
|
|
|
# ('subod.subsubod.third', {'subsubod': {'dyn': True, 'hidden': True}}),
|
|
|
|
('subod.subsubodval1.firstval1', None),
|
|
|
|
# ('subod.subsubodval1.firstval1', None),
|
|
|
|
('subod.subsubodval1.secondval1', None),
|
|
|
|
# ('subod.subsubodval1.secondval1', None),
|
|
|
|
('subod.subsubodval1.thirdval1', None),
|
|
|
|
# ('subod.subsubodval1.thirdval1', None),
|
|
|
|
('subod.subsubodval2.firstval2', None),
|
|
|
|
# ('subod.subsubodval2.firstval2', None),
|
|
|
|
('subod.subsubodval2.secondval2', None),
|
|
|
|
# ('subod.subsubodval2.secondval2', None),
|
|
|
|
('subod.subsubodval2.thirdval2', 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}}),
|
|
|
|
#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.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}}),
|
|
|
|
# ('subod.subsubod.third', {'subod': {'dyn': True}, 'subsubod': {'master': True}, 'third': {'hidden': True, 'slave': True}}),
|
|
|
|
('subodval1.subsubodval1.firstval1', None),
|
|
|
|
# ('subodval1.subsubodval1.firstval1', None),
|
|
|
|
('subodval1.subsubodval1.secondval1', None),
|
|
|
|
# ('subodval1.subsubodval1.secondval1', None),
|
|
|
|
('subodval1.subsubodval1.thirdval1', None),
|
|
|
|
# ('subodval1.subsubodval1.thirdval1', None),
|
|
|
|
('subodval2.subsubodval2.firstval2', None),
|
|
|
|
# ('subodval2.subsubodval2.firstval2', None),
|
|
|
|
('subodval2.subsubodval2.secondval2', None),
|
|
|
|
# ('subodval2.subsubodval2.secondval2', None),
|
|
|
|
('subodval2.subsubodval2.thirdval2', None)]),
|
|
|
|
# ('subodval2.subsubodval2.thirdval2', None)]),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1734,16 +1717,27 @@ def test_options(paths):
|
|
|
|
return kwargs
|
|
|
|
return kwargs
|
|
|
|
|
|
|
|
|
|
|
|
lpaths = list(paths.keys())
|
|
|
|
lpaths = list(paths.keys())
|
|
|
|
for meta in (False, True):
|
|
|
|
|
|
|
|
for callback in (False, True):
|
|
|
|
# for meta in (False, True):
|
|
|
|
for consistency in (False, True):
|
|
|
|
# for callback in (False, True):
|
|
|
|
for require in (False, True):
|
|
|
|
# for consistency in (False, True):
|
|
|
|
for default_multi in (False, True):
|
|
|
|
# for require in (False, True):
|
|
|
|
for symlink in (False, True):
|
|
|
|
# for default_multi in (False, True):
|
|
|
|
|
|
|
|
# for symlink in (False, True):
|
|
|
|
|
|
|
|
# if callback and default_multi:
|
|
|
|
|
|
|
|
# continue
|
|
|
|
|
|
|
|
# for default in (False, True):
|
|
|
|
|
|
|
|
# for multi in (False, True, submulti):
|
|
|
|
|
|
|
|
for meta in (False,):
|
|
|
|
|
|
|
|
for callback in (False,):
|
|
|
|
|
|
|
|
for consistency in (False,):
|
|
|
|
|
|
|
|
for require in (False,):
|
|
|
|
|
|
|
|
for default_multi in (False,):
|
|
|
|
|
|
|
|
for symlink in (False,):
|
|
|
|
if callback and default_multi:
|
|
|
|
if callback and default_multi:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
for default in (False, True):
|
|
|
|
for default in (False,):
|
|
|
|
for multi in (False, True, submulti):
|
|
|
|
for multi in (False,):
|
|
|
|
if multi is submulti and default:
|
|
|
|
if multi is submulti and default:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
if multi is submulti and consistency:
|
|
|
|
if multi is submulti and consistency:
|
|
|
|