feat(lotto): backtest API 라우터 + main 등록

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:20:32 +09:00
parent a425bb8809
commit 3bc4f423db
3 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import os, sys, tempfile
# _shared lives in web-backend/_shared; add the parent dir so it can be found
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
from fastapi.testclient import TestClient
def _client(monkeypatch):
tmp = tempfile.mkdtemp()
from app import db
monkeypatch.setattr(db, "DB_PATH", os.path.join(tmp, "lotto.db"))
db.init_db()
from app.main import app
return TestClient(app), db
def test_backtest_endpoints(monkeypatch):
client, db = _client(monkeypatch)
r = client.get("/api/lotto/backtest/track-record")
assert r.status_code == 200
assert "by_strategy" in r.json()
r2 = client.get("/api/lotto/backtest/calibration?weeks=4")
assert r2.status_code == 200
assert isinstance(r2.json().get("history"), list)