mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Fix f-strings and linter
This commit is contained in:
parent
a012369164
commit
f985507761
3 changed files with 4 additions and 20 deletions
|
@ -79,7 +79,7 @@ class BaseAuthenticator(object):
|
|||
except MoulinetteError:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.exception("authentication {self.name} failed because '{e}'")
|
||||
logger.exception(f"authentication {self.name} failed because '{e}'")
|
||||
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||
else:
|
||||
is_authenticated = True
|
||||
|
@ -93,7 +93,7 @@ class BaseAuthenticator(object):
|
|||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
logger.exception("unable to store session because %s", e)
|
||||
logger.exception(f"unable to store session because {e}")
|
||||
else:
|
||||
logger.debug("session has been stored")
|
||||
|
||||
|
@ -108,7 +108,7 @@ class BaseAuthenticator(object):
|
|||
except MoulinetteError:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.exception("authentication {self.name} failed because '{e}'")
|
||||
logger.exception(f"authentication {self.name} failed because '{e}'")
|
||||
raise MoulinetteAuthenticationError("unable_authenticate")
|
||||
else:
|
||||
is_authenticated = True
|
||||
|
|
|
@ -8,6 +8,7 @@ logger = logging.getLogger("moulinette.authenticator.yoloswag")
|
|||
|
||||
# Dummy authenticator implementation
|
||||
|
||||
|
||||
class Authenticator(BaseAuthenticator):
|
||||
|
||||
"""Dummy authenticator used for tests"""
|
||||
|
|
|
@ -156,27 +156,10 @@ def test_required_paremeter_missing_value(iface, caplog):
|
|||
|
||||
|
||||
def test_actions_map_unknown_authenticator(monkeypatch, tmp_path):
|
||||
# from moulinette.interfaces.cli import ActionsMapParser
|
||||
# import argparse
|
||||
#
|
||||
# parser = argparse.ArgumentParser(add_help=False)
|
||||
# parser.add_argument(
|
||||
# "--debug",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Log and print debug messages",
|
||||
# )
|
||||
#
|
||||
#monkeypatch.setenv("MOULINETTE_DATA_DIR", str(tmp_path))
|
||||
#actionsmap_dir = tmp_path / "actionsmap"
|
||||
#actionsmap_dir.mkdir()
|
||||
|
||||
from moulinette.interfaces.api import ActionsMapParser
|
||||
amap = ActionsMap(ActionsMapParser())
|
||||
|
||||
#from moulinette.interfaces import BaseActionsMapParser
|
||||
#amap = ActionsMap(BaseActionsMapParser())
|
||||
|
||||
with pytest.raises(MoulinetteError) as exception:
|
||||
amap.get_authenticator("unknown")
|
||||
assert "No module named" in str(exception)
|
||||
|
|
Loading…
Reference in a new issue