feat: 대시보드 헤더에 모의투자/실전투자 모드 배지 표시 (#237)
Some checks failed
CI / test (pull_request) Has been cancelled

- /api/status 응답에 MODE 환경변수 기반 mode 필드 추가
- 대시보드 헤더에 모드 배지 표시 (live=빨간색 깜빡임, paper=노란색)
- 모드 관련 테스트 3개 추가 (total 26 passed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
agentson
2026-02-24 06:48:22 +09:00
parent 847456e0af
commit a063bd9d10
3 changed files with 55 additions and 0 deletions

View File

@@ -413,3 +413,30 @@ def test_status_circuit_breaker_unknown_when_no_data(tmp_path: Path) -> None:
cb = body["circuit_breaker"]
assert cb["status"] == "unknown"
assert cb["current_pnl_pct"] is None
def test_status_mode_paper(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""MODE=paper일 때 status 응답에 mode=paper가 포함돼야 한다."""
monkeypatch.setenv("MODE", "paper")
app = _app(tmp_path)
get_status = _endpoint(app, "/api/status")
body = get_status()
assert body["mode"] == "paper"
def test_status_mode_live(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""MODE=live일 때 status 응답에 mode=live가 포함돼야 한다."""
monkeypatch.setenv("MODE", "live")
app = _app(tmp_path)
get_status = _endpoint(app, "/api/status")
body = get_status()
assert body["mode"] == "live"
def test_status_mode_default_paper(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""MODE 환경변수가 없으면 mode 기본값은 paper여야 한다."""
monkeypatch.delenv("MODE", raising=False)
app = _app(tmp_path)
get_status = _endpoint(app, "/api/status")
body = get_status()
assert body["mode"] == "paper"