right OrderedDict (for python2) and use fixture for test_tree_od_permissive
This commit is contained in:
parent
582b0c027c
commit
39348a14aa
|
@ -754,39 +754,39 @@ def make_api(options, multi):
|
||||||
|
|
||||||
DICT_PATHS = [
|
DICT_PATHS = [
|
||||||
#test a config without optiondescription
|
#test a config without optiondescription
|
||||||
OrderedDict({'first': 'first',
|
OrderedDict([('first', 'first'),
|
||||||
'second': 'second_disabled',
|
('second', 'second_disabled'),
|
||||||
'third': 'third_hidden'}),
|
('third', 'third_hidden')]),
|
||||||
#test a config with an optiondescription
|
#test a config with an optiondescription
|
||||||
OrderedDict({'subod.first': 'subod.first',
|
OrderedDict([('subod.first', 'subod.first'),
|
||||||
'subod.second': 'subod.second_disabled',
|
('subod.second', 'subod.second_disabled'),
|
||||||
'subod.third': 'subod.third_hidden'}),
|
('subod.third', 'subod.third_hidden')]),
|
||||||
#test a config with two optiondescription
|
#test a config with two optiondescription
|
||||||
OrderedDict({'subod.subsubod.first': 'subod.subsubod.first',
|
OrderedDict([('subod.subsubod.first', 'subod.subsubod.first'),
|
||||||
'subod.subsubod.second': 'subod.subsubod.second_disabled',
|
('subod.subsubod.second', 'subod.subsubod.second_disabled'),
|
||||||
'subod.subsubod.third': 'subod.subsubod.third_hidden'}),
|
('subod.subsubod.third', 'subod.subsubod.third_hidden')]),
|
||||||
#test a config with mix of different optiondescription
|
#test a config with mix of different optiondescription
|
||||||
OrderedDict({'first': 'first',
|
OrderedDict([('first', 'first'),
|
||||||
'subod.second': 'subod.second_disabled',
|
('subod.second', 'subod.second_disabled'),
|
||||||
'subod.subsubod.third': 'subod.subsubod.third_hidden'}),
|
('subod.subsubod.third', 'subod.subsubod.third_hidden')]),
|
||||||
#test a config with masterslaves
|
#test a config with masterslaves
|
||||||
OrderedDict({'first.first': 'first_master.first',
|
OrderedDict([('first.first', 'first_master.first'),
|
||||||
'first.second': 'first_master.second_disabled',
|
('first.second', 'first_master.second_disabled'),
|
||||||
'first.third': 'first_master.third_hidden'}),
|
('first.third', 'first_master.third_hidden')]),
|
||||||
##test a config with dynoption
|
##test a config with dynoption
|
||||||
OrderedDict({'subodval1.firstval1': 'subod_dyn.first',
|
OrderedDict([('subodval1.firstval1', 'subod_dyn.first'),
|
||||||
'subodval1.secondval1': 'subod_dyn.second_disabled',
|
('subodval1.secondval1', 'subod_dyn.second_disabled'),
|
||||||
'subodval1.thirdval1': 'subod_dyn.third_hidden',
|
('subodval1.thirdval1', 'subod_dyn.third_hidden'),
|
||||||
'subodval2.firstval2': None,
|
('subodval2.firstval2', None),
|
||||||
'subodval2.secondval2': None,
|
('subodval2.secondval2', None),
|
||||||
'subodval2.thirdval2': None}),
|
('subodval2.thirdval2', None)]),
|
||||||
#test a config with dynoption subdir
|
#test a config with dynoption subdir
|
||||||
OrderedDict({'subod.subodval1.firstval1': 'subod.subod_dyn.first',
|
OrderedDict([('subod.subodval1.firstval1', 'subod.subod_dyn.first'),
|
||||||
'subod.subodval1.secondval1': 'subod.subod_dyn.second_disabled',
|
('subod.subodval1.secondval1', 'subod.subod_dyn.second_disabled'),
|
||||||
'subod.subodval1.thirdval1': 'subod.subod_dyn.third_hidden',
|
('subod.subodval1.thirdval1', 'subod.subod_dyn.third_hidden'),
|
||||||
'subod.subodval2.firstval2': None,
|
('subod.subodval2.firstval2', None),
|
||||||
'subod.subodval2.secondval2': None,
|
('subod.subodval2.secondval2', None),
|
||||||
'subod.subodval2.thirdval2': None})
|
('subod.subodval2.thirdval2', None)])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -814,31 +814,37 @@ def test_options(paths):
|
||||||
#print(api.help)
|
#print(api.help)
|
||||||
|
|
||||||
|
|
||||||
@display_info
|
DICT_PATHS2 = [
|
||||||
def test_tree_od_permissive():
|
OrderedDict([('subod.subsubod.first', 'subod.subsubod_hidden.first'),
|
||||||
|
('subod.subsubod.second', 'subod.subsubod_hidden.second'),
|
||||||
|
('subod.subsubod.third', 'subod.subsubod_hidden.third_hidden')]),
|
||||||
|
OrderedDict([('subod.subodval1.firstval1', 'subod.subod_dyn_hidden.first'),
|
||||||
|
('subod.subodval1.secondval1', 'subod.subod_dyn_hidden.second'),
|
||||||
|
('subod.subodval1.thirdval1', 'subod.subod_dyn_hidden.third_hidden'),
|
||||||
|
('subod.subodval2.firstval2', None),
|
||||||
|
('subod.subodval2.secondval2', None),
|
||||||
|
('subod.subodval2.thirdval2', None)])
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="function", params=DICT_PATHS2)
|
||||||
|
def paths2(request):
|
||||||
|
print(u'\n{} {}: {}'.format(ICON, request.function.__name__, request.param))
|
||||||
|
return request.param
|
||||||
|
|
||||||
|
|
||||||
|
def test_tree_od_permissive(paths2):
|
||||||
"""permissive when optiondescription is hidden
|
"""permissive when optiondescription is hidden
|
||||||
"""
|
"""
|
||||||
tpaths = [
|
lpaths = list(paths2.keys())
|
||||||
OrderedDict({'subod.subsubod.first': 'subod.subsubod_hidden.first',
|
for multi in (False, True):
|
||||||
'subod.subsubod.second': 'subod.subsubod_hidden.second',
|
api = make_api(paths2.values(), multi)
|
||||||
'subod.subsubod.third': 'subod.subsubod_hidden.third_hidden'}),
|
if api is None:
|
||||||
OrderedDict({'subod.subodval1.firstval1': 'subod.subod_dyn_hidden.first',
|
continue
|
||||||
'subod.subodval1.secondval1': 'subod.subod_dyn_hidden.second',
|
check_all(api, lpaths[0], multi, permissive=True)
|
||||||
'subod.subodval1.thirdval1': 'subod.subod_dyn_hidden.third_hidden',
|
check_all(api, lpaths[1], multi, permissive=True)
|
||||||
'subod.subodval2.firstval2': None,
|
check_all(api, lpaths[2], multi, permissive=True, extra_properties=['hidden'])
|
||||||
'subod.subodval2.secondval2': None,
|
if len(lpaths) == 6:
|
||||||
'subod.subodval2.thirdval2': None})
|
check_all(api, lpaths[3], multi, permissive=True)
|
||||||
]
|
check_all(api, lpaths[4], multi, permissive=True)
|
||||||
for paths in tpaths:
|
check_all(api, lpaths[5], multi, permissive=True, extra_properties=['hidden'])
|
||||||
lpaths = list(paths.keys())
|
|
||||||
for multi in (False, True):
|
|
||||||
api = make_api(paths.values(), 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'])
|
|
||||||
|
|
Loading…
Reference in New Issue