Merge branch 'master' into orm

Conflicts:
	test/test_option_consistency.py
	test/test_state.py
	tiramisu/option.py
This commit is contained in:
2014-02-06 22:21:22 +01:00
5 changed files with 469 additions and 412 deletions

View File

@ -186,6 +186,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', '')
@ -234,6 +246,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']
@ -277,6 +291,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_1():
a = NetworkOption('a', '', '192.168.1.0')
b = NetmaskOption('b', '', '255.255.255.128')
@ -307,3 +335,14 @@ def test_consistency_not_all():
c.a = ['192.168.1.0']
c.b = ['255.255.255.0']
c.c = ['192.168.1.255']
def test_consistency_permissive():
a = IntOption('a', '', 1)
b = IntOption('b', '', 2, properties=('hidden',))
od = OptionDescription('od', '', [a, b])
a.impl_add_consistency('not_equal', b)
c = Config(od)
c.cfgimpl_get_settings().setpermissive(('hidden',))
c.read_write()
c.a = 1