test callback with permissive
This commit is contained in:
parent
9831f7cf0c
commit
c44aab67b8
@ -980,7 +980,7 @@ def autocheck_option(api, path, confread, confwrite, **kwargs):
|
|||||||
assert doc == "{}'s option".format(expected_name)
|
assert doc == "{}'s option".format(expected_name)
|
||||||
|
|
||||||
|
|
||||||
#@autocheck
|
@autocheck
|
||||||
def autocheck_permissive(api, path, confread, confwrite, **kwargs):
|
def autocheck_permissive(api, path, confread, confwrite, **kwargs):
|
||||||
"""test permissive for hidden and disabled value
|
"""test permissive for hidden and disabled value
|
||||||
"""
|
"""
|
||||||
@ -997,6 +997,13 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs):
|
|||||||
|
|
||||||
# set permissive
|
# set permissive
|
||||||
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled']))
|
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
|
# have permissive
|
||||||
assert api.unrestraint.config(confwrite).option(path).permissive.get() == frozenset(['disabled'])
|
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)
|
_autocheck_default_value(api, path, confread, **ckwargs)
|
||||||
|
|
||||||
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['disabled', 'hidden']))
|
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
|
# can access to all value except when optiondescript have hidden
|
||||||
if not ckwargs.get('permissive_od', False):
|
if not ckwargs.get('permissive_od', False):
|
||||||
@ -1028,6 +1037,8 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs):
|
|||||||
|
|
||||||
# only hidden
|
# only hidden
|
||||||
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset(['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):
|
if ckwargs.get('permissive_od', False):
|
||||||
_autocheck_default_value(api, path, confread, **ckwargs)
|
_autocheck_default_value(api, path, confread, **ckwargs)
|
||||||
if confread != confwrite:
|
if confread != confwrite:
|
||||||
@ -1041,6 +1052,8 @@ def autocheck_permissive(api, path, confread, confwrite, **kwargs):
|
|||||||
|
|
||||||
# no permissive
|
# no permissive
|
||||||
api.unrestraint.config(confwrite).option(path).permissive.set(frozenset())
|
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):
|
if ckwargs.get('permissive_od', False):
|
||||||
_autocheck_default_value(api, path, confread, **ckwargs)
|
_autocheck_default_value(api, path, confread, **ckwargs)
|
||||||
if confread != confwrite:
|
if confread != confwrite:
|
||||||
|
Loading…
Reference in New Issue
Block a user