Files
FabledScribe/tests/test_mcp_tool_tasks_kind.py
T
bvandeusen b255a0f90e
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 35s
CI & Build / Python tests (push) Successful in 54s
CI & Build / Build & push image (push) Successful in 1m14s
refactor: rename package fabledassistant -> scribe (code-only)
Renames src/fabledassistant -> src/scribe and all imports, plus the
default DB name and DB user/password (fabled -> scribe) in config +
compose. 952 refs / 154 files. Reverses the old 'internal name stays
fabledassistant' convention.

Code-only: live databases are still physically named 'fabledassistant'.
Deployed environments must set POSTGRES_DB / POSTGRES_USER (or rename the
DB) since the defaults now resolve to 'scribe'. Repo (FabledScribe), git
host (fabledsword), MCP (fabled-git) and the image name (fabledscribe)
are intentionally unchanged.

ruff check src/ clean locally; CI (typecheck + pytest) is the gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:48:35 -04:00

46 lines
1.4 KiB
Python

from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from scribe.mcp._context import _user_id_ctx
@pytest.fixture(autouse=True)
def _bind_user():
token = _user_id_ctx.set(7)
yield
_user_id_ctx.reset(token)
def _fake_note(task_kind="work"):
n = MagicMock()
n.to_dict.return_value = {"id": 1, "title": "T", "task_kind": task_kind}
return n
@pytest.mark.asyncio
async def test_create_task_passes_kind():
mock = AsyncMock(return_value=_fake_note(task_kind="plan"))
with patch("scribe.mcp.tools.tasks.notes_svc.create_note", mock):
from scribe.mcp.tools.tasks import create_task
await create_task(title="P", kind="plan")
assert mock.call_args.kwargs["task_kind"] == "plan"
@pytest.mark.asyncio
async def test_list_tasks_passes_kind_filter():
mock = AsyncMock(return_value=([], 0))
with patch("scribe.mcp.tools.tasks.notes_svc.list_notes", mock):
from scribe.mcp.tools.tasks import list_tasks
await list_tasks(kind="plan")
assert mock.call_args.kwargs["task_kind"] == "plan"
@pytest.mark.asyncio
async def test_list_tasks_kind_empty_means_no_filter():
mock = AsyncMock(return_value=([], 0))
with patch("scribe.mcp.tools.tasks.notes_svc.list_notes", mock):
from scribe.mcp.tools.tasks import list_tasks
await list_tasks()
assert mock.call_args.kwargs["task_kind"] is None