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