add test for properties
This commit is contained in:
parent
a1bb6370ca
commit
51d420b29d
|
@ -392,7 +392,20 @@ def test_requires_transitive_hidden_disabled_multiple():
|
||||||
except PropertiesOptionError as err:
|
except PropertiesOptionError as err:
|
||||||
props = err.proptype
|
props = err.proptype
|
||||||
assert set(props) == {'disabled', 'hidden'}
|
assert set(props) == {'disabled', 'hidden'}
|
||||||
raises(RequirementError, "api.option('ip_address_service_web').value.get()")
|
req = None
|
||||||
|
try:
|
||||||
|
api.option('ip_address_service_web').value.get()
|
||||||
|
except RequirementError as err:
|
||||||
|
req = err
|
||||||
|
assert req, "ip_address_service_web should raise RequirementError"
|
||||||
|
assert str(req) == str(_('cannot access to option "{}" because required option "{}" has {} {}').format('ip_address_service_web', 'activate_service_web', 'property', '"disabled"'))
|
||||||
|
api.permissive.set(frozenset())
|
||||||
|
try:
|
||||||
|
api.option('ip_address_service_web').value.get()
|
||||||
|
except RequirementError as err:
|
||||||
|
req = err
|
||||||
|
assert req, "ip_address_service_web should raise RequirementError"
|
||||||
|
assert str(req) == str(_('cannot access to option "{}" because required option "{}" has {} {}').format('ip_address_service_web', 'activate_service_web', 'properties', '"disabled" and "hidden"'))
|
||||||
|
|
||||||
|
|
||||||
def test_requires_not_transitive():
|
def test_requires_not_transitive():
|
||||||
|
|
|
@ -871,7 +871,7 @@ class TiramisuContextPermissive(TiramisuContext):
|
||||||
@count
|
@count
|
||||||
def get(self):
|
def get(self):
|
||||||
"""get configuration permissives"""
|
"""get configuration permissives"""
|
||||||
self.config_bag.config.cfgimpl_get_settings().get_context_permissive(permissives)
|
return self.config_bag.config.cfgimpl_get_settings().get_context_permissive()
|
||||||
|
|
||||||
@count
|
@count
|
||||||
def set(self, permissives):
|
def set(self, permissives):
|
||||||
|
@ -886,7 +886,7 @@ class TiramisuContextPermissive(TiramisuContext):
|
||||||
@count
|
@count
|
||||||
def importation(self, permissives):
|
def importation(self, permissives):
|
||||||
"""import configuration permissives"""
|
"""import configuration permissives"""
|
||||||
return self.config_bag.config.cfgimpl_get_settings()._pp_.importation(permissives)
|
self.config_bag.config.cfgimpl_get_settings()._pp_.importation(permissives)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,8 @@ class PropertiesOptionError(AttributeError):
|
||||||
self._requires,
|
self._requires,
|
||||||
self._index,
|
self._index,
|
||||||
True,
|
True,
|
||||||
self._config_bag)
|
self._config_bag,
|
||||||
|
self._name)
|
||||||
#if req != {} or self._orig_opt is not None:
|
#if req != {} or self._orig_opt is not None:
|
||||||
if req != {}:
|
if req != {}:
|
||||||
only_one = len(req) == 1
|
only_one = len(req) == 1
|
||||||
|
|
|
@ -376,7 +376,8 @@ class Settings(object):
|
||||||
opt.impl_getrequires(),
|
opt.impl_getrequires(),
|
||||||
index,
|
index,
|
||||||
False,
|
False,
|
||||||
config_bag)
|
config_bag,
|
||||||
|
opt.impl_get_display_name())
|
||||||
props -= self.getpermissive(opt,
|
props -= self.getpermissive(opt,
|
||||||
path)
|
path)
|
||||||
if apply_requires and config_bag.setting_properties is not None and \
|
if apply_requires and config_bag.setting_properties is not None and \
|
||||||
|
@ -410,7 +411,7 @@ class Settings(object):
|
||||||
index,
|
index,
|
||||||
readable,
|
readable,
|
||||||
config_bag,
|
config_bag,
|
||||||
name=None):
|
name):
|
||||||
"""carries out the jit (just in time) requirements between options
|
"""carries out the jit (just in time) requirements between options
|
||||||
|
|
||||||
a requirement is a tuple of this form that comes from the option's
|
a requirement is a tuple of this form that comes from the option's
|
||||||
|
@ -514,7 +515,7 @@ class Settings(object):
|
||||||
'').format(name,
|
'').format(name,
|
||||||
option.impl_get_display_name(),
|
option.impl_get_display_name(),
|
||||||
prop_msg,
|
prop_msg,
|
||||||
display_list(list(properties))))
|
display_list(list(properties), add_quote=True)))
|
||||||
# transitive action, add action
|
# transitive action, add action
|
||||||
if operator != 'and':
|
if operator != 'and':
|
||||||
if readable:
|
if readable:
|
||||||
|
@ -522,7 +523,8 @@ class Settings(object):
|
||||||
err._requires,
|
err._requires,
|
||||||
err._index,
|
err._index,
|
||||||
True,
|
True,
|
||||||
err._config_bag).values():
|
err._config_bag,
|
||||||
|
err._name).values():
|
||||||
calc_properties.setdefault(action, []).extend(msg)
|
calc_properties.setdefault(action, []).extend(msg)
|
||||||
else:
|
else:
|
||||||
calc_properties.add(action)
|
calc_properties.add(action)
|
||||||
|
|
Loading…
Reference in New Issue