From c44aab67b87d3374ba744f39546e99e78acb88c1 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 29 Nov 2017 07:14:29 +0100 Subject: [PATCH] test callback with permissive --- test/api/test_owner.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/api/test_owner.py b/test/api/test_owner.py index d1fe343..eea0be6 100644 --- a/test/api/test_owner.py +++ b/test/api/test_owner.py @@ -980,7 +980,7 @@ def autocheck_option(api, path, confread, confwrite, **kwargs): assert doc == "{}'s option".format(expected_name) -#@autocheck +@autocheck def autocheck_permissive(api, path, confread, confwrite, **kwargs): """test permissive for hidden and disabled value """ @@ -997,6 +997,13 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs): # set permissive api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled'])) + callback = kwargs['callback'] + if callback: + if path.endswith('val1') or path.endswith('val2'): + call_path = path[:-4] + 'call' + path[-4:] + else: + call_path = path + 'call' + api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['disabled'])) # have permissive assert api.unrestraint.config(confwrite).option(path).permissive.get() == frozenset(['disabled']) @@ -1009,6 +1016,8 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs): _autocheck_default_value(api, path, confread, **ckwargs) api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled', 'hidden'])) + if kwargs['callback']: + api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['disabled', 'hidden'])) # can access to all value except when optiondescript have hidden if not ckwargs.get('permissive_od', False): @@ -1028,6 +1037,8 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs): # only hidden api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['hidden'])) + if callback: + api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset(['hidden'])) if ckwargs.get('permissive_od', False): _autocheck_default_value(api, path, confread, **ckwargs) if confread != confwrite: @@ -1041,6 +1052,8 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs): # no permissive api.unrestraint.config(confwrite).option(path).permissive.set(frozenset()) + if callback: + api.unrestraint.config(confwrite).option(call_path).permissive.set(frozenset()) if ckwargs.get('permissive_od', False): _autocheck_default_value(api, path, confread, **ckwargs) if confread != confwrite: