drift-quant / tests /test_secrets.py
deveshc23
Initialize architecture and engineering foundation
c962775
Raw History Blame Contribute Delete
535 Bytes
from __future__ import annotations
import pytest
from drift_quant.secrets import SecretConfigurationError, load_required_secret
def test_secret_value_is_redacted_when_rendered() -> None:
secret = load_required_secret("TEST_SECRET", {"TEST_SECRET": "not-for-logs"})
assert str(secret) == "[REDACTED]"
assert "not-for-logs" not in repr(secret)
def test_missing_secret_does_not_echo_value() -> None:
with pytest.raises(SecretConfigurationError, match="TEST_SECRET"):
load_required_secret("TEST_SECRET", {})