setpermissive => setpermissives

This commit is contained in:
2018-08-18 08:14:47 +02:00
parent b381e0322f
commit 89ccfa8aa1
4 changed files with 23 additions and 17 deletions

View File

@ -27,6 +27,7 @@ def test_permissive():
props = err.proptype
assert set(props) == {'disabled'}
api.unrestraint.permissive.set(frozenset(['disabled']))
assert api.unrestraint.permissive.get() == frozenset(['disabled'])
props = frozenset()
try:
api.option('u1').value.get()
@ -58,6 +59,7 @@ def test_permissive_mandatory():
else:
assert frozenset(props) == frozenset(['disabled'])
api.unrestraint.permissive.set(frozenset(['mandatory', 'disabled']))
assert api.unrestraint.permissive.get() == frozenset(['mandatory', 'disabled'])
api.property.add('permissive')
api.option('u1').value.get()
api.property.pop('permissive')
@ -76,6 +78,7 @@ def test_permissive_frozen():
api = Config(descr)
api.property.read_write()
api.unrestraint.permissive.set(frozenset(['frozen', 'disabled']))
assert api.unrestraint.permissive.get() == frozenset(['frozen', 'disabled'])
try:
api.option('u1').value.set(1)
except PropertiesOptionError as err:
@ -232,6 +235,7 @@ def test_permissive_option_mandatory():
else:
assert frozenset(props) == frozenset(['disabled'])
api.unrestraint.option('u1').permissive.set(frozenset(['mandatory', 'disabled']))
assert api.unrestraint.option('u1').permissive.get() == frozenset(['mandatory', 'disabled'])
api.property.add('permissive')
api.option('u1').value.get()
api.property.pop('permissive')
@ -274,6 +278,8 @@ def test_remove_option_permissive():
api.property.read_write()
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")
api.forcepermissive.option('od1.var1').permissive.set(frozenset(['hidden']))
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset(['hidden'])
assert api.option('od1.var1').value.get() == 'value'
api.forcepermissive.option('od1.var1').permissive.set(frozenset())
assert api.forcepermissive.option('od1.var1').permissive.get() == frozenset()
raises(PropertiesOptionError, "api.option('od1.var1').value.get()")