From b0fd78657e11e0c97668373612f3b90ca5f9bd28 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 27 Aug 2021 19:45:07 +0200 Subject: [PATCH] Moaaaar lint/test fixes --- moulinette/interfaces/cli.py | 2 +- test/src/authenticators/dummy.py | 2 +- test/src/authenticators/yoloswag.py | 2 +- test/test_auth.py | 11 +++-------- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/moulinette/interfaces/cli.py b/moulinette/interfaces/cli.py index 745d8fee..733f6301 100644 --- a/moulinette/interfaces/cli.py +++ b/moulinette/interfaces/cli.py @@ -554,7 +554,7 @@ class Interface: return value - def display(self, message, style="info"): # m18n: info + def display(self, message, style="info"): # i18n: info """Display a message""" if style == "success": print("{} {}".format(colorize(m18n.g("success"), "green"), message)) diff --git a/test/src/authenticators/dummy.py b/test/src/authenticators/dummy.py index e0a23401..904d6ed4 100644 --- a/test/src/authenticators/dummy.py +++ b/test/src/authenticators/dummy.py @@ -21,6 +21,6 @@ class Authenticator(BaseAuthenticator): def _authenticate_credentials(self, credentials=None): if not credentials == self.name: - raise MoulinetteError("invalid_password") + raise MoulinetteError("invalid_password", raw_msg=True) return diff --git a/test/src/authenticators/yoloswag.py b/test/src/authenticators/yoloswag.py index a746f599..d199f121 100644 --- a/test/src/authenticators/yoloswag.py +++ b/test/src/authenticators/yoloswag.py @@ -21,6 +21,6 @@ class Authenticator(BaseAuthenticator): def _authenticate_credentials(self, credentials=None): if not credentials == self.name: - raise MoulinetteError("invalid_password") + raise MoulinetteError("invalid_password", raw_msg=True) return diff --git a/test/test_auth.py b/test/test_auth.py index a432afed..65f3f4ad 100644 --- a/test/test_auth.py +++ b/test/test_auth.py @@ -217,17 +217,14 @@ class TestAuthCLI: with pytest.raises(MoulinetteError) as exception: moulinette_cli.run(["testauth", "other-profile"], output_as="none") - translation = m18n.g("invalid_password") - expected_msg = translation.format() - assert expected_msg in str(exception) + assert "invalid_password" in str(exception) mocker.patch("os.isatty", return_value=True) mocker.patch("getpass.getpass", return_value="yoloswag") with pytest.raises(MoulinetteError) as exception: moulinette_cli.run(["testauth", "default"], output_as="none") - expected_msg = translation.format() - assert expected_msg in str(exception) + assert "invalid_password" in str(exception) def test_request_no_auth_needed(self, capsys, moulinette_cli): moulinette_cli.run(["testauth", "none"], output_as="plain") @@ -259,9 +256,7 @@ class TestAuthCLI: message = capsys.readouterr() assert "some_data_from_only_cli" not in message.out - translation = m18n.g("invalid_password") - expected_msg = translation.format() - assert expected_msg in str(exception) + assert "invalid_password" in str(exception) def test_request_with_callback(self, moulinette_cli, capsys, mocker): mocker.patch("os.isatty", return_value=True)