Attempt to fix the tests :s

This commit is contained in:
Alexandre Aubin 2020-05-01 06:11:14 +02:00
parent 677f4518e4
commit a2a6e6fe7c
2 changed files with 9 additions and 24 deletions

View file

@ -125,13 +125,8 @@ def moulinette_webapi(moulinette):
CookiePolicy.return_ok_secure = return_true
moulinette_webapi = moulinette.init_interface(
"api",
kwargs={"routes": {}, "use_websocket": False},
actionsmap={"namespaces": ["moulitest"], "use_cache": True},
)
return TestApp(moulinette_webapi._app)
from moulinette.interfaces.api import Interface as Api
return TestApp(Api(routes={})._app)
@pytest.fixture
@ -148,17 +143,11 @@ def moulinette_cli(moulinette, mocker):
help="Log and print debug messages",
)
mocker.patch("os.isatty", return_value=True)
moulinette_cli = moulinette.init_interface(
"cli",
actionsmap={
"namespaces": ["moulitest"],
"use_cache": False,
"parser_kwargs": {"top_parser": parser},
},
)
from moulinette.interfaces.cli import Interface as Cli
cli = Cli(top_parser=parser)
mocker.stopall()
return moulinette_cli
return cli
@pytest.fixture

View file

@ -225,7 +225,7 @@ def test_extra_argument_parser_parse_args(iface, mocker):
def test_actions_map_api():
from moulinette.interfaces.api import ActionsMapParser
amap = ActionsMap(ActionsMapParser, use_cache=False)
amap = ActionsMap(ActionsMapParser())
assert amap.parser.global_conf["authenticate"] == "all"
assert "default" in amap.parser.global_conf["authenticator"]
@ -235,7 +235,7 @@ def test_actions_map_api():
amap.generate_cache()
amap = ActionsMap(ActionsMapParser, use_cache=True)
amap = ActionsMap(ActionsMapParser())
assert amap.parser.global_conf["authenticate"] == "all"
assert "default" in amap.parser.global_conf["authenticator"]
@ -274,9 +274,7 @@ def test_actions_map_cli():
default=False,
help="Log and print debug messages",
)
amap = ActionsMap(
ActionsMapParser, use_cache=False, parser_kwargs={"top_parser": parser}
)
amap = ActionsMap(ActionsMapParser(top_parser=parser))
assert amap.parser.global_conf["authenticate"] == "all"
assert "default" in amap.parser.global_conf["authenticator"]
@ -295,9 +293,7 @@ def test_actions_map_cli():
amap.generate_cache()
amap = ActionsMap(
ActionsMapParser, use_cache=True, parser_kwargs={"top_parser": parser}
)
amap = ActionsMap(ActionsMapParser(top_parser=parser))
assert amap.parser.global_conf["authenticate"] == "all"
assert "default" in amap.parser.global_conf["authenticator"]