slave with requires could not raise
[tiramisu.git] / test / test_requires.py
index dace0ca..5395160 100644 (file)
@@ -644,6 +644,12 @@ def test_master_slave_requires():
     cfg.ip_admin_eth0.ip_admin_eth0.append('192.168.1.1')
     assert cfg.ip_admin_eth0.netmask_admin_eth0[0] is None
     raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[1]")
+    cfg.ip_admin_eth0.ip_admin_eth0[1] = '192.168.1.2'
+    assert cfg.ip_admin_eth0.netmask_admin_eth0[1] is None
+    cfg.ip_admin_eth0.netmask_admin_eth0[1] = '255.255.255.255'
+    assert cfg.ip_admin_eth0.netmask_admin_eth0[1] == '255.255.255.255'
+    cfg.ip_admin_eth0.ip_admin_eth0[1] = '192.168.1.1'
+    raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[1]")
 
 
 def test_master_slave_requires_no_master():
@@ -668,3 +674,11 @@ def test_master_slave_requires_no_master():
     raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0")
     raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[0]")
     raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[1]")
+    cfg.activate = True
+    assert cfg.ip_admin_eth0.netmask_admin_eth0 == [None, None]
+    cfg.ip_admin_eth0.netmask_admin_eth0 = [None, '255.255.255.255']
+    assert cfg.ip_admin_eth0.netmask_admin_eth0[1] == '255.255.255.255'
+    cfg.activate = False
+    raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0")
+    raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[0]")
+    raises(PropertiesOptionError, "cfg.ip_admin_eth0.netmask_admin_eth0[1]")