Add BOINC Telegram bot, CI, and deploy compose
All checks were successful
publish-images / build (push) Successful in 1m3s

This commit is contained in:
dan
2026-01-06 09:44:48 +03:00
commit 55cfd73c24
15 changed files with 617 additions and 0 deletions

6
tests/conftest.py Normal file
View File

@@ -0,0 +1,6 @@
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

View File

@@ -0,0 +1,17 @@
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