if option with requires has a property, calculated properties are store in storage
[tiramisu.git] / test / test_requires.py
index 4cf9372..ff9c2a6 100644 (file)
@@ -24,6 +24,28 @@ def test_requires():
     except PropertiesOptionError as err:
         props = err.proptype
     assert props == ['disabled']
+    c.activate_service = True
+    c.ip_address_service
+
+
+def test_requires_with_requires():
+    a = BoolOption('activate_service', '', True)
+    b = IPOption('ip_address_service', '',
+                 requires=[{'option': a, 'expected': False, 'action': 'disabled'}])
+    od = OptionDescription('service', '', [a, b])
+    c = Config(od)
+    c.read_write()
+    c.cfgimpl_get_settings()[b].append('test')
+    c.ip_address_service
+    c.activate_service = False
+    props = []
+    try:
+        c.ip_address_service
+    except PropertiesOptionError as err:
+        props = err.proptype
+    assert props == ['disabled']
+    c.activate_service = True
+    c.ip_address_service
 
 
 def test_requires_invalid():