Files
BOINC-report-bot/tests/test_boinc_parser.py
dan 55cfd73c24
All checks were successful
publish-images / build (push) Successful in 1m3s
Add BOINC Telegram bot, CI, and deploy compose
2026-01-06 09:44:48 +03:00

18 lines
604 B
Python

from datetime import datetime, timezone
from pathlib import Path
from bot.boinc import BoincSnapshot, parse_boinccmd_tasks
def test_parse_sample_tasks():
text = Path("sample_data/boinccmd_tasks.txt").read_text()
tasks = parse_boinccmd_tasks(text)
assert len(tasks) == 3
assert tasks[0].status == "active"
assert tasks[1].status == "completed"
assert tasks[2].status == "active"
snapshot = BoincSnapshot(tasks=tasks, fetched_at=datetime.now(timezone.utc))
assert len(snapshot.active) == 2
assert len(snapshot.completed) == 1
assert snapshot.average_progress > 0