Files
Bithumb/tests/test_watch_ops.py
dsyoon 72de8d534e feat(vol_breakout): 15m 현물 롱 라이브·모니터·cron 운영 추가
vol_breakout 멀티종목 tick, vol_live HTML 모니터, 마감 봉만 저장하는 캔들 다운로드,
텔레그램 체결 알림, cron/watch 감시 스크립트 및 테스트를 포함한다.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 08:31:14 +09:00

43 lines
1.2 KiB
Python

"""watch_ops 단위 테스트."""
from __future__ import annotations
from datetime import datetime, timedelta
from bithumb.operations.watch_ops import WatchIssue, WatchReport, remediate_ops_watch
class _FakeSettings:
ops_mode = "live"
ops_telegram_enabled = False
telegram_bot_token = ""
telegram_chat_id = ""
ops_watch_auto_remediate = True
ops_watch_auto_restart = False
ops_tick_lock_path = None
ops_loop_pid_file = None
def test_remediate_dry_run_no_actions() -> None:
"""dry-run은 tick/재시작 없음."""
report = WatchReport(
checked_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
issues=[
WatchIssue(
kind="miss_pending",
severity="critical",
message="test",
)
],
)
result = remediate_ops_watch(_FakeSettings(), report, dry_run=True)
assert "dry_run" in result.actions
assert result.tick_report is None
def test_remediate_ok_when_no_issues() -> None:
"""이슈 없으면 조치 없음."""
report = WatchReport(checked_at="2026-06-14 20:00:00")
result = remediate_ops_watch(_FakeSettings(), report, dry_run=False)
assert result.actions == []