"""F1 — V1_TOKEN_PATH default가 legacy/signal_v1/ 경유인지 검증.""" from pathlib import Path from ai_trade.config import Settings def test_v1_token_default_path_uses_legacy_dir(monkeypatch): """env에 V1_TOKEN_PATH 없으면 legacy/signal_v1/data/kis_token.json""" monkeypatch.delenv("V1_TOKEN_PATH", raising=False) settings = Settings() expected_suffix = Path("legacy") / "signal_v1" / "data" / "kis_token.json" assert str(settings.v1_token_path).endswith(str(expected_suffix)), ( f"expected default to end with {expected_suffix}, got {settings.v1_token_path}" ) def test_v1_token_env_override_wins(monkeypatch, tmp_path): """env로 명시한 경로가 default를 덮어씀.""" custom = tmp_path / "custom_token.json" monkeypatch.setenv("V1_TOKEN_PATH", str(custom)) settings = Settings() assert settings.v1_token_path == custom