mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Moaaaar lint/test fixes
This commit is contained in:
parent
3c4520a6d8
commit
b0fd78657e
4 changed files with 6 additions and 11 deletions
|
@ -554,7 +554,7 @@ class Interface:
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def display(self, message, style="info"): # m18n: info
|
def display(self, message, style="info"): # i18n: info
|
||||||
"""Display a message"""
|
"""Display a message"""
|
||||||
if style == "success":
|
if style == "success":
|
||||||
print("{} {}".format(colorize(m18n.g("success"), "green"), message))
|
print("{} {}".format(colorize(m18n.g("success"), "green"), message))
|
||||||
|
|
|
@ -21,6 +21,6 @@ class Authenticator(BaseAuthenticator):
|
||||||
def _authenticate_credentials(self, credentials=None):
|
def _authenticate_credentials(self, credentials=None):
|
||||||
|
|
||||||
if not credentials == self.name:
|
if not credentials == self.name:
|
||||||
raise MoulinetteError("invalid_password")
|
raise MoulinetteError("invalid_password", raw_msg=True)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -21,6 +21,6 @@ class Authenticator(BaseAuthenticator):
|
||||||
def _authenticate_credentials(self, credentials=None):
|
def _authenticate_credentials(self, credentials=None):
|
||||||
|
|
||||||
if not credentials == self.name:
|
if not credentials == self.name:
|
||||||
raise MoulinetteError("invalid_password")
|
raise MoulinetteError("invalid_password", raw_msg=True)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -217,17 +217,14 @@ class TestAuthCLI:
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
moulinette_cli.run(["testauth", "other-profile"], output_as="none")
|
moulinette_cli.run(["testauth", "other-profile"], output_as="none")
|
||||||
|
|
||||||
translation = m18n.g("invalid_password")
|
assert "invalid_password" in str(exception)
|
||||||
expected_msg = translation.format()
|
|
||||||
assert expected_msg in str(exception)
|
|
||||||
|
|
||||||
mocker.patch("os.isatty", return_value=True)
|
mocker.patch("os.isatty", return_value=True)
|
||||||
mocker.patch("getpass.getpass", return_value="yoloswag")
|
mocker.patch("getpass.getpass", return_value="yoloswag")
|
||||||
with pytest.raises(MoulinetteError) as exception:
|
with pytest.raises(MoulinetteError) as exception:
|
||||||
moulinette_cli.run(["testauth", "default"], output_as="none")
|
moulinette_cli.run(["testauth", "default"], output_as="none")
|
||||||
|
|
||||||
expected_msg = translation.format()
|
assert "invalid_password" in str(exception)
|
||||||
assert expected_msg in str(exception)
|
|
||||||
|
|
||||||
def test_request_no_auth_needed(self, capsys, moulinette_cli):
|
def test_request_no_auth_needed(self, capsys, moulinette_cli):
|
||||||
moulinette_cli.run(["testauth", "none"], output_as="plain")
|
moulinette_cli.run(["testauth", "none"], output_as="plain")
|
||||||
|
@ -259,9 +256,7 @@ class TestAuthCLI:
|
||||||
message = capsys.readouterr()
|
message = capsys.readouterr()
|
||||||
assert "some_data_from_only_cli" not in message.out
|
assert "some_data_from_only_cli" not in message.out
|
||||||
|
|
||||||
translation = m18n.g("invalid_password")
|
assert "invalid_password" in str(exception)
|
||||||
expected_msg = translation.format()
|
|
||||||
assert expected_msg in str(exception)
|
|
||||||
|
|
||||||
def test_request_with_callback(self, moulinette_cli, capsys, mocker):
|
def test_request_with_callback(self, moulinette_cli, capsys, mocker):
|
||||||
mocker.patch("os.isatty", return_value=True)
|
mocker.patch("os.isatty", return_value=True)
|
||||||
|
|
Loading…
Reference in a new issue