feat(auth): prendre en charge le PIN de compte Pronote
This commit is contained in:
@@ -207,4 +207,21 @@ def test_qr_pin_in_redaction_secrets(monkeypatch: MonkeyPatch) -> None:
|
||||
assert "**********" in repr(settings.pronote.qr_pin)
|
||||
|
||||
|
||||
def test_account_pin_loaded_as_secretstr_and_redacted(monkeypatch: MonkeyPatch) -> None:
|
||||
"""Vérifie que ``PRONOTE_ACCOUNT_PIN`` est secret et expurgé.
|
||||
|
||||
:param monkeypatch: Fixture pytest pour modifier temporairement l'environnement.
|
||||
:return: None
|
||||
"""
|
||||
monkeypatch.setenv("PRONOTE_ACCOUNT_PIN", "account-pin-42")
|
||||
settings = load_settings()
|
||||
|
||||
assert isinstance(settings.pronote.account_pin, SecretStr)
|
||||
assert settings.pronote.account_pin.get_secret_value() == "account-pin-42"
|
||||
assert settings.pronote.account_pin in settings.redaction_secrets()
|
||||
assert "account-pin-42" not in str(settings)
|
||||
assert "account-pin-42" not in settings.model_dump_json()
|
||||
assert "**********" in settings.model_dump_json()
|
||||
|
||||
|
||||
# Ensure trailing newline
|
||||
|
||||
Reference in New Issue
Block a user