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)
|
||||
|
||||
|
||||
#@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:
|
||||
|
Loading…
Reference in New Issue
Block a user