From 53dd9fe973ee818e373478d4584bc0765a276658 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 25 Jan 2021 18:51:40 +0100 Subject: [PATCH] fix actionsmap tests --- test/test_actionsmap.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/test_actionsmap.py b/test/test_actionsmap.py index deaf52f5..a509b1da 100644 --- a/test/test_actionsmap.py +++ b/test/test_actionsmap.py @@ -188,8 +188,11 @@ def test_extra_argument_parser_add_argument_bad_arg(iface): with pytest.raises(MoulinetteError) as exception: extra_argument_parse.add_argument(GLOBAL_SECTION, "foo", {"ask": 1}) - translation = m18n.g("error") - expected_msg = translation.format() + expected_msg = "unable to validate extra parameter '%s' for argument '%s': %s" % ( + "ask", + "foo", + "parameter value must be a string, got 1", + ) assert expected_msg in str(exception) extra_argument_parse = ExtraArgumentParser(iface) @@ -258,15 +261,18 @@ def test_actions_map_import_error(mocker): def import_mock(name, globals={}, locals={}, fromlist=[], level=-1): if name == "moulitest.testauth": mocker.stopall() - raise ImportError + raise ImportError("Yoloswag") return orig_import(name, globals, locals, fromlist, level) mocker.patch("builtins.__import__", side_effect=import_mock) with pytest.raises(MoulinetteError) as exception: amap.process({}, timeout=30, route=("GET", "/test-auth/none")) - translation = m18n.g("error") - expected_msg = translation.format() + expected_msg = "unable to load function % s.%s because: %s" % ( + "moulitest", + "testauth_none", + "Yoloswag", + ) assert expected_msg in str(exception)