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:
@@ -1,4 +1,5 @@
|
||||
"""task_kind create + list-filter behavior in services/notes.py."""
|
||||
"""create_note carries the task_kind it is given onto the row. The list
|
||||
filter is proven against real Postgres in test_integration_task_kind_list."""
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
@@ -20,19 +21,3 @@ async def test_create_note_passes_task_kind_to_model():
|
||||
from grimoire.services.notes import create_note
|
||||
await create_note(user_id=1, title="P", status="todo", task_kind="plan")
|
||||
assert captured["task_kind"] == "plan"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_notes_filters_by_task_kind():
|
||||
mock_session = make_mock_session()
|
||||
mock_session.scalar = AsyncMock(return_value=0)
|
||||
exec_result = MagicMock()
|
||||
exec_result.scalars.return_value.all.return_value = []
|
||||
mock_session.execute = AsyncMock(return_value=exec_result)
|
||||
with patch("grimoire.services.notes.async_session") as mock_cls:
|
||||
mock_cls.return_value = mock_session
|
||||
from grimoire.services.notes import list_notes
|
||||
# Should not raise; task_kind is a recognized kwarg.
|
||||
rows, total = await list_notes(user_id=1, is_task=True, task_kind="plan")
|
||||
assert rows == []
|
||||
assert total == 0
|
||||
|
||||
Reference in New Issue
Block a user