add test_properties
This commit is contained in:
parent
4ee9cc82b2
commit
cf3e8cded9
@ -12,6 +12,32 @@ from tiramisu.error import PropertiesOptionError, RequirementError
|
||||
from py.test import raises
|
||||
|
||||
|
||||
def test_properties():
|
||||
a = BoolOption('activate_service', '', True)
|
||||
b = IPOption('ip_address_service', '', properties=('disabled',))
|
||||
od = OptionDescription('service', '', [a, b])
|
||||
api = getapi(Config(od))
|
||||
api.property.read_write()
|
||||
props = []
|
||||
try:
|
||||
api.option('ip_address_service').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
api.option('ip_address_service').property.pop('disabled')
|
||||
api.option('ip_address_service').value.get()
|
||||
api.option('ip_address_service').property.add('disabled')
|
||||
props = []
|
||||
try:
|
||||
api.option('ip_address_service').value.get()
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert frozenset(props) == frozenset(['disabled'])
|
||||
# pop twice
|
||||
api.option('ip_address_service').property.pop('disabled')
|
||||
api.option('ip_address_service').property.pop('disabled')
|
||||
|
||||
|
||||
def test_requires():
|
||||
a = BoolOption('activate_service', '', True)
|
||||
b = IPOption('ip_address_service', '',
|
||||
|
Loading…
Reference in New Issue
Block a user