autocheck_option corrections

This commit is contained in:
2018-04-05 21:20:39 +02:00
parent 73d27af971
commit 38890519c9
2 changed files with 42 additions and 37 deletions

View File

@ -945,37 +945,37 @@ def autocheck_set_owner_permissive(api, pathread, pathwrite, confread, confwrite
_check_owner(api, pathread, confread, kwargs, 'new_user1', 'new_user1')
#FIXME @autocheck
#def autocheck_option(api, pathread, pathwrite, confread, confwrite, **kwargs):
# expected_name = pathread.split('.')[-1]
# if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
# current_name = api.option(pathread).option.name
# assert current_name == api.forcepermissive.option(pathread).option.name
# assert current_name == api.unrestraint.option(pathread).option.name
# doc = api.option(pathread).option.doc()
# assert doc == api.forcepermissive.option(pathread).option.doc()
# assert doc == api.unrestraint.option(pathread).option.doc()
# elif not kwargs.get('propertyerror', False):
# raises(PropertiesOptionError, "api.option(pathread).option.name")
# current_name = api.forcepermissive.option(pathread).option.name
# assert current_name == api.unrestraint.option(pathread).option.name
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
# doc = api.forcepermissive.option(pathread).option.doc()
# assert doc == api.unrestraint.option(pathread).option.doc()
# else:
# raises(PropertiesOptionError, "api.option(pathread).option.name")
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.name")
# current_name = api.unrestraint.option(pathread).option.name
# raises(PropertiesOptionError, "api.option(pathread).option.doc()")
# raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.doc()")
# doc = api.unrestraint.option(pathread).option.doc()
# assert current_name == expected_name
# if expected_name.endswith('val1') or expected_name.endswith('val2'):
# expected_name = expected_name[:-4]
# if kwargs['symlink']:
# assert doc == "{}'s option link".format(expected_name)
# else:
# assert doc == "{}'s option".format(expected_name)
@autocheck
def autocheck_option(api, pathread, pathwrite, confread, confwrite, **kwargs):
expected_name = pathread.split('.')[-1]
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
current_name = api.option(pathread).option.name()
assert current_name == api.forcepermissive.option(pathread).option.name()
assert current_name == api.unrestraint.option(pathread).option.name()
doc = api.option(pathread).option.doc()
assert doc == api.forcepermissive.option(pathread).option.doc()
assert doc == api.unrestraint.option(pathread).option.doc()
elif not kwargs.get('propertyerror', False):
raises(PropertiesOptionError, "api.option(pathread).option.name()")
current_name = api.forcepermissive.option(pathread).option.name()
assert current_name == api.unrestraint.option(pathread).option.name()
raises(PropertiesOptionError, "api.option(pathread).option.doc()")
doc = api.forcepermissive.option(pathread).option.doc()
assert doc == api.unrestraint.option(pathread).option.doc()
else:
raises(PropertiesOptionError, "api.option(pathread).option.name()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.name()")
current_name = api.unrestraint.option(pathread).option.name()
raises(PropertiesOptionError, "api.option(pathread).option.doc()")
raises(PropertiesOptionError, "api.forcepermissive.option(pathread).option.doc()")
doc = api.unrestraint.option(pathread).option.doc()
assert current_name == expected_name
if expected_name.endswith('val1') or expected_name.endswith('val2'):
expected_name = expected_name[:-4]
if kwargs['symlink']:
assert doc == "{}'s option link".format(expected_name)
else:
assert doc == "{}'s option".format(expected_name)
@autocheck