more tests

This commit is contained in:
2014-02-06 22:17:20 +01:00
parent 72f06bc29d
commit e7531e1fda
5 changed files with 93 additions and 48 deletions

View File

@ -169,6 +169,18 @@ def test_consistency_network_netmask():
raises(ValueError, "c.a = '192.168.1.1'")
def test_consistency_ip_netmask_network_error():
a = IPOption('a', '')
b = NetworkOption('b', '')
c = NetmaskOption('c', '')
od = OptionDescription('od', '', [a, b, c])
c.impl_add_consistency('ip_netmask', a, b)
c = Config(od)
c.a = '192.168.1.1'
c.b = '192.168.1.0'
raises(ConfigError, "c.c = '255.255.255.0'")
def test_consistency_ip_netmask_error_multi():
a = IPOption('a', '', multi=True)
b = NetmaskOption('b', '')
@ -217,6 +229,8 @@ def test_consistency_ip_netmask_multi_master():
c.b = ['255.255.255.255']
c.b = ['255.255.255.0']
raises(ValueError, "c.a = ['192.168.1.0']")
c.a = ['192.168.1.128']
raises(ValueError, "c.b = ['255.255.255.128']")
c.a = ['192.168.1.2', '192.168.1.3']
@ -260,6 +274,20 @@ def test_consistency_broadcast():
c.c[1] = '192.168.2.255'
def test_consistency_broadcast_error():
a = NetworkOption('a', '', multi=True)
b = NetmaskOption('b', '', multi=True)
c = BroadcastOption('c', '', multi=True)
od = OptionDescription('a', '', [a, b, c])
od.impl_set_group_type(groups.master)
b.impl_add_consistency('network_netmask', a)
c.impl_add_consistency('broadcast', a)
c = Config(od)
c.a = ['192.168.1.0']
c.b = ['255.255.255.0']
raises(ConfigError, "c.c = ['192.168.1.255']")
def test_consistency_broadcast_default():
a = NetworkOption('a', '', '192.168.1.0')
b = NetmaskOption('b', '', '255.255.255.128')