mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
fix conf authenticate all
This commit is contained in:
parent
94ccd9b05c
commit
ce5d7ddaf0
2 changed files with 9 additions and 6 deletions
|
@ -245,8 +245,11 @@ class BaseActionsMapParser(object):
|
|||
elif ifaces is False:
|
||||
conf["authenticate"] = False
|
||||
elif isinstance(ifaces, list):
|
||||
# Store only if authentication is needed
|
||||
conf["authenticate"] = True if self.interface in ifaces else False
|
||||
if "all" in ifaces:
|
||||
conf["authenticate"] = "all"
|
||||
else:
|
||||
# Store only if authentication is needed
|
||||
conf["authenticate"] = True if self.interface in ifaces else False
|
||||
else:
|
||||
logger.error(
|
||||
"expecting 'all', 'False' or a list for "
|
||||
|
|
|
@ -221,7 +221,7 @@ def test_actions_map_api():
|
|||
|
||||
amap = ActionsMap(ActionsMapParser, use_cache=False)
|
||||
|
||||
assert amap.parser.global_conf['authenticate'] == False
|
||||
assert amap.parser.global_conf['authenticate'] == "all"
|
||||
assert 'default' in amap.parser.global_conf['authenticator']
|
||||
assert 'yoloswag' in amap.parser.global_conf['authenticator']
|
||||
assert ('GET', '/test-auth/default') in amap.parser.routes
|
||||
|
@ -231,7 +231,7 @@ def test_actions_map_api():
|
|||
|
||||
amap = ActionsMap(ActionsMapParser, use_cache=True)
|
||||
|
||||
assert amap.parser.global_conf['authenticate'] == False
|
||||
assert amap.parser.global_conf['authenticate'] == "all"
|
||||
assert 'default' in amap.parser.global_conf['authenticator']
|
||||
assert 'yoloswag' in amap.parser.global_conf['authenticator']
|
||||
assert ('GET', '/test-auth/default') in amap.parser.routes
|
||||
|
@ -266,7 +266,7 @@ def test_actions_map_cli():
|
|||
)
|
||||
amap = ActionsMap(ActionsMapParser, use_cache=False, parser_kwargs={'top_parser': parser})
|
||||
|
||||
assert amap.parser.global_conf['authenticate'] == False
|
||||
assert amap.parser.global_conf['authenticate'] == "all"
|
||||
assert 'default' in amap.parser.global_conf['authenticator']
|
||||
assert 'yoloswag' in amap.parser.global_conf['authenticator']
|
||||
assert 'testauth' in amap.parser._subparsers.choices
|
||||
|
@ -278,7 +278,7 @@ def test_actions_map_cli():
|
|||
|
||||
amap = ActionsMap(ActionsMapParser, use_cache=True, parser_kwargs={'top_parser': parser})
|
||||
|
||||
assert amap.parser.global_conf['authenticate'] == False
|
||||
assert amap.parser.global_conf['authenticate'] == "all"
|
||||
assert 'default' in amap.parser.global_conf['authenticator']
|
||||
assert 'yoloswag' in amap.parser.global_conf['authenticator']
|
||||
assert 'testauth' in amap.parser._subparsers.choices
|
||||
|
|
Loading…
Add table
Reference in a new issue