Merge branch 'feature/new_api' into feature/3.0
This commit is contained in:
@ -801,7 +801,7 @@ def make_api(options, multi):
|
||||
if 'options' in collected:
|
||||
options.extend(collected['options'])
|
||||
for key, values in collected.items():
|
||||
if key == 'options':
|
||||
if key in ['options', 'properties']:
|
||||
continue
|
||||
option = make_optiondescriptions(key, values)
|
||||
if option is None:
|
||||
@ -817,9 +817,9 @@ def make_api(options, multi):
|
||||
continue
|
||||
local_collect_options = collect_options
|
||||
for optiondescription in path.split('.')[:-1]:
|
||||
local_collect_options.setdefault(optiondescription, {})
|
||||
local_collect_options.setdefault(optiondescription, {'properties': {}})
|
||||
local_collect_options = local_collect_options[optiondescription]
|
||||
local_collect_options['properties'] = option.get(optiondescription, {})
|
||||
local_collect_options['properties'].update(option.get(optiondescription, {}))
|
||||
option_name = path.split('.')[-1]
|
||||
path = '.'.join(path.split('.')[:-1])
|
||||
local_collect_options.setdefault('options', []).append(make_option(option_name, option.get(option_name)))
|
||||
@ -853,7 +853,7 @@ DICT_PATHS = [
|
||||
('odmaster.second', {'second': {'disabled': True}}),
|
||||
('odmaster.third', {'third': {'hidden': True}})]),
|
||||
##test a config with dynoption
|
||||
OrderedDict([('subod.firstv', {'subod': {'dyn': True}}),
|
||||
OrderedDict([('subod.first', {'subod': {'dyn': True}}),
|
||||
('subod.second', {'second': {'disabled': True}}),
|
||||
('subod.third', {'third': {'hidden': True}}),
|
||||
('subodval1.firstval1', None),
|
||||
@ -863,7 +863,7 @@ DICT_PATHS = [
|
||||
('subodval2.secondval2', None),
|
||||
('subodval2.thirdval2', None)]),
|
||||
#test a config with dynoption subdir
|
||||
OrderedDict([('subod.subsubod.first', {'subod': {'dyn': True}}),
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True}}),
|
||||
('subod.subsubod.second', {'second': {'disabled': True}}),
|
||||
('subod.subsubod.third', {'third': {'hidden': True}}),
|
||||
('subod.subsubodval1.firstval1', None),
|
||||
@ -888,23 +888,24 @@ def test_options(paths):
|
||||
api = make_api(paths, multi)
|
||||
if api is None:
|
||||
continue
|
||||
check_all(api, lpaths[0], multi)
|
||||
check_all(api, lpaths[1], multi, propertyerror=True, extra_properties=['disabled'])
|
||||
check_all(api, lpaths[2], multi, permissive=True, extra_properties=['hidden'])
|
||||
if len(lpaths) == 6:
|
||||
if len(lpaths) == 9:
|
||||
check_all(api, lpaths[3], multi)
|
||||
check_all(api, lpaths[4], multi, propertyerror=True, extra_properties=['disabled'])
|
||||
check_all(api, lpaths[5], multi, permissive=True, extra_properties=['hidden'])
|
||||
##
|
||||
#print('')
|
||||
#print(api.help)
|
||||
check_all(api, lpaths[6], multi)
|
||||
check_all(api, lpaths[7], multi, propertyerror=True, extra_properties=['disabled'])
|
||||
check_all(api, lpaths[8], multi, permissive=True, extra_properties=['hidden'])
|
||||
else:
|
||||
check_all(api, lpaths[0], multi)
|
||||
check_all(api, lpaths[1], multi, propertyerror=True, extra_properties=['disabled'])
|
||||
check_all(api, lpaths[2], multi, permissive=True, extra_properties=['hidden'])
|
||||
|
||||
|
||||
DICT_PATHS2 = [
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'hidden': True}}),
|
||||
('subod.subsubod.second', {}),
|
||||
('subod.subsubod.third', {})]),
|
||||
OrderedDict([('subod.subsubod.first', {'subsub': {'dyn': True, 'hidden': True}}),
|
||||
OrderedDict([('subod.subsubod.first', {'subsubod': {'dyn': True, 'hidden': True}}),
|
||||
('subod.subsubod.second', {}),
|
||||
('subod.subsubod.third', {}),
|
||||
('subod.subsubodval1.firstval1', None),
|
||||
@ -923,19 +924,22 @@ def paths2(request):
|
||||
return request.param
|
||||
|
||||
|
||||
#FIXME
|
||||
#def test_tree_od_permissive(paths2):
|
||||
# """permissive when optiondescription is hidden
|
||||
# """
|
||||
# lpaths = list(paths2.keys())
|
||||
# for multi in (False, True):
|
||||
# api = make_api(paths2, multi)
|
||||
# if api is None:
|
||||
# continue
|
||||
# check_all(api, lpaths[0], multi, permissive=True)
|
||||
# check_all(api, lpaths[1], multi, permissive=True)
|
||||
# check_all(api, lpaths[2], multi, permissive=True, extra_properties=['hidden'])
|
||||
# if len(lpaths) == 6:
|
||||
# check_all(api, lpaths[3], multi, permissive=True)
|
||||
# check_all(api, lpaths[4], multi, permissive=True)
|
||||
# check_all(api, lpaths[5], multi, permissive=True, extra_properties=['hidden'])
|
||||
def test_tree_od_permissive(paths2):
|
||||
"""permissive when optiondescription is hidden
|
||||
"""
|
||||
lpaths = list(paths2.keys())
|
||||
for multi in (False, True):
|
||||
api = make_api(paths2, multi)
|
||||
if api is None:
|
||||
continue
|
||||
if len(lpaths) == 9:
|
||||
check_all(api, lpaths[3], multi, permissive=True)
|
||||
check_all(api, lpaths[4], multi, permissive=True)
|
||||
check_all(api, lpaths[5], multi, permissive=True)
|
||||
check_all(api, lpaths[6], multi, permissive=True)
|
||||
check_all(api, lpaths[7], multi, permissive=True)
|
||||
check_all(api, lpaths[8], multi, permissive=True)
|
||||
else:
|
||||
check_all(api, lpaths[0], multi, permissive=True)
|
||||
check_all(api, lpaths[1], multi, permissive=True)
|
||||
check_all(api, lpaths[2], multi, permissive=True)
|
||||
|
Reference in New Issue
Block a user