multi, None and validation
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import autopath
|
||||
from py.test import raises
|
||||
|
||||
from tiramisu.setting import owners
|
||||
from tiramisu.setting import owners, groups
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import IPOption, NetworkOption, NetmaskOption, IntOption,\
|
||||
OptionDescription
|
||||
@ -85,7 +85,13 @@ def test_consistency_network_netmask():
|
||||
raises(ValueError, "c.a = '192.168.1.1'")
|
||||
|
||||
|
||||
#FIXME pas de multi si pas de multi en maitre
|
||||
def test_consistency_ip_netmask_error_multi():
|
||||
a = IPOption('a', '', multi=True)
|
||||
b = NetmaskOption('b', '')
|
||||
od = OptionDescription('od', '', [a, b])
|
||||
raises(ValueError, "b.impl_add_consistency('ip_netmask', a)")
|
||||
|
||||
|
||||
def test_consistency_ip_netmask_multi():
|
||||
a = IPOption('a', '', multi=True)
|
||||
b = NetmaskOption('b', '', multi=True)
|
||||
@ -112,3 +118,33 @@ def test_consistency_network_netmask_multi():
|
||||
c.a = ['192.168.1.0']
|
||||
c.b = ['255.255.255.0']
|
||||
raises(ValueError, "c.a = ['192.168.1.1']")
|
||||
|
||||
|
||||
def test_consistency_ip_netmask_multi_master():
|
||||
a = IPOption('a', '', multi=True)
|
||||
b = NetmaskOption('b', '', multi=True)
|
||||
od = OptionDescription('a', '', [a, b])
|
||||
od.impl_set_group_type(groups.master)
|
||||
b.impl_add_consistency('ip_netmask', a)
|
||||
c = Config(od)
|
||||
c.a = ['192.168.1.1']
|
||||
c.b = ['255.255.255.0']
|
||||
c.a = ['192.168.1.2']
|
||||
c.b = ['255.255.255.255']
|
||||
c.b = ['255.255.255.0']
|
||||
raises(ValueError, "c.a = ['192.168.1.0']")
|
||||
|
||||
|
||||
def test_consistency_network_netmask_multi_master():
|
||||
a = NetworkOption('a', '', multi=True)
|
||||
b = NetmaskOption('b', '', multi=True)
|
||||
od = OptionDescription('a', '', [a, b])
|
||||
od.impl_set_group_type(groups.master)
|
||||
b.impl_add_consistency('network_netmask', a)
|
||||
c = Config(od)
|
||||
c.a = ['192.168.1.1']
|
||||
c.b = ['255.255.255.255']
|
||||
del(c.b)
|
||||
c.a = ['192.168.1.0']
|
||||
c.b = ['255.255.255.0']
|
||||
raises(ValueError, "c.a = ['192.168.1.1']")
|
||||
|
Reference in New Issue
Block a user