코드 리뷰 F1: V1이 legacy/signal_v1/로 이동되었으나 config.py default가 구 경로를 가리켜 .env 미설정 시 KIS REST가 V1 token file missing으로 실패. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23 lines
896 B
Python
23 lines
896 B
Python
"""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
|