"""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 from tests.helpers import make_mock_session @pytest.mark.asyncio async def test_create_note_passes_task_kind_to_model(): mock_session = make_mock_session() captured = {} def _capture_add(obj): captured["task_kind"] = getattr(obj, "task_kind", "MISSING") mock_session.add = MagicMock(side_effect=_capture_add) with patch("grimoire.services.notes.async_session") as mock_cls, \ patch("grimoire.services.notes._maybe_reactivate_project", AsyncMock()): mock_cls.return_value = mock_session 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"