"""Settings refuse weak secrets at startup.""" from __future__ import annotations import pytest from pydantic import ValidationError from ypms.settings import Settings def test_short_jwt_secret_refused(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("JWT_SECRET", "x" * 31) with pytest.raises(ValidationError, match="jwt_secret"): Settings() # type: ignore[call-arg] def test_32_byte_jwt_secret_accepted(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("JWT_SECRET", "x" * 32) assert Settings().jwt_secret == "x" * 32 # type: ignore[call-arg]