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

View file

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