transitive in apply_requires should only by apply if properties are same has testing action

This commit is contained in:
2016-10-12 22:17:04 +02:00
parent c31590c2ac
commit 2e4fdbca03
3 changed files with 35 additions and 1 deletions

View File

@ -349,6 +349,31 @@ def test_requires_not_transitive():
c.ip_address_service_web
def test_requires_not_transitive_not_same_action():
a = BoolOption('activate_service', '', True)
b = BoolOption('activate_service_web', '', True,
requires=[{'option': a, 'expected': False, 'action': 'disabled'}])
d = IPOption('ip_address_service_web', '',
requires=[{'option': b, 'expected': False,
'action': 'hidden', 'transitive': False}])
od = OptionDescription('service', '', [a, b, d])
c = Config(od)
c.read_write()
c.activate_service
c.activate_service_web
c.ip_address_service_web
c.activate_service = False
#
props = []
try:
c.activate_service_web
except PropertiesOptionError as err:
props = err.proptype
assert props == ['disabled']
#
raises(RequirementError, "c.ip_address_service_web")
def test_requires_None():
a = BoolOption('activate_service', '')
b = IPOption('ip_address_service', '',