add test for consistency with callback
authorEmmanuel Garette <egarette@cadoles.com>
Wed, 12 Mar 2014 15:44:48 +0000 (16:44 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Wed, 12 Mar 2014 15:44:48 +0000 (16:44 +0100)
test/test_option_consistency.py

index b40c340..45e8213 100644 (file)
@@ -345,3 +345,17 @@ def test_consistency_permissive():
     c.cfgimpl_get_settings().setpermissive(('hidden',))
     c.read_write()
     c.a = 1
+
+
+def return_val(*args, **kwargs):
+    return '192.168.1.1'
+
+
+def test_consistency_with_callback():
+    a = NetworkOption('a', '', default='192.168.1.0')
+    b = NetmaskOption('b', '', default='255.255.255.0')
+    c = IPOption('c', '', callback=return_val, callback_params={'': ((a, False),)})
+    od = OptionDescription('od', '', [a, b, c])
+    c.impl_add_consistency('in_network', a, b)
+    cfg = Config(od)
+    cfg.c