test(8249): task kinds are proven by a listing, not by a signature

Review of the small test groups. Four tests pinned an argument list or a
function existing where the behaviour was untested or tested elsewhere:
- test_routes_planning: the signature check and the callable check become
  one check that POST /api/tasks/planning is routed on the app.
- test_routes_tasks_kind: both signature checks go; create_note and
  list_notes are called with task_kind by tests that would fail without it,
  and the blueprint check is covered by the planning route check.
- test_list_notes_filters_by_task_kind asserted only that the call did not
  raise. It is replaced by a database test that lists issues, work and all
  kinds and checks the rows and the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 02:51:13 -05:00
co-authored by Claude Opus 5.5
parent 7c7a1a7ab9
commit fc1e30588e
4 changed files with 56 additions and 44 deletions
+45
View File
@@ -0,0 +1,45 @@
"""Listing tasks by kind returns that kind only, counted the same way.
A mocked session cannot show this: the filter is a WHERE clause, and only a
real query proves it keeps the issue out of a list of work and the count in
step with the page.
"""
import pytest
import pytest_asyncio
from grimoire.models import async_session
from grimoire.models.note import Note
from grimoire.models.project import Project
from grimoire.services import notes as notes_svc
from tests.helpers import ensure_user
pytestmark = [pytest.mark.integration, pytest.mark.usefixtures("_dispose_engine", "_no_embedding")]
@pytest_asyncio.fixture
async def world():
async with async_session() as s:
owner = await ensure_user(s, "task_kind_lister")
project = Project(user_id=owner.id, title="Kinds")
s.add(project)
await s.flush()
s.add_all([
Note(user_id=owner.id, project_id=project.id, title=f"{kind} {i}",
status="todo", task_kind=kind)
for kind, n in (("work", 2), ("issue", 1), ("spike", 1)) for i in range(n)
])
await s.commit()
return {"owner": owner.id, "pid": project.id}
@pytest.mark.parametrize("kind, titles", [
("issue", ["issue 0"]),
("work", ["work 0", "work 1"]),
(None, ["issue 0", "spike 0", "work 0", "work 1"]),
])
async def test_listing_by_kind_returns_that_kind_and_counts_it(world, kind, titles):
rows, total = await notes_svc.list_notes(
world["owner"], is_task=True, project_id=world["pid"], task_kind=kind,
)
assert sorted(r.title for r in rows) == titles
assert total == len(titles)