Files
rdb-discovery/tests/test_tasks.py
T

30 lines
826 B
Python

from pathlib import Path
from rdb_discovery.tasks import get_next_task, update_task_status
def test_get_next_task(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS.md\n\n"
"## TASK-001 - First\nStatus: Done\n\n"
"## TASK-002 - Second\nStatus: Todo\n\n",
encoding="utf-8",
)
task = get_next_task(tmp_path)
assert task is not None
assert task.task_id == "TASK-002"
assert task.title == "Second"
def test_update_task_status(tmp_path: Path) -> None:
tasks = tmp_path / "TASKS.md"
tasks.write_text(
"# TASKS.md\n\n## TASK-001 - First\nStatus: Todo\n\n",
encoding="utf-8",
)
assert update_task_status(tmp_path, "TASK-001", "In Progress") is True
assert "Status: In Progress" in tasks.read_text(encoding="utf-8")