From e6dd89346fc345d2296c542238b41a594bf8d654 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 22 Mar 2026 15:45:38 +0200 Subject: [PATCH] fix: update tests for recall query changes and mypy asyncpg import - Add shared_by/share_permission to mock row defaults - Update recall tests to handle 3+1 fetch calls (own, shared, tag-shared, OR-fallback) --- tests/test_api.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 6027a31..debd6fc 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -37,6 +37,8 @@ def _make_memory_row(**overrides): "created_at": now, "updated_at": now, "deleted_at": None, + "shared_by": None, + "share_permission": None, } defaults.update(overrides) return MockRow(defaults) @@ -139,8 +141,12 @@ async def test_store_memory_creates_record_with_user_id(client): @pytest.mark.asyncio async def test_recall_returns_only_user_memories(client): ac, conn, app_mod = client - conn.fetch.return_value = [ - _make_memory_row(id=1, content="user memory", is_sensitive=False), + # recall calls fetch 3 times: own, shared, tag-shared; plus OR-fallback if < limit + conn.fetch.side_effect = [ + [_make_memory_row(id=1, content="user memory", is_sensitive=False)], # own + [], # individually shared + [], # tag-shared + [], # OR-match fallback ] async with ac: @@ -164,8 +170,10 @@ async def test_recall_returns_only_user_memories(client): @pytest.mark.asyncio async def test_recall_redacts_sensitive_memories(client): ac, conn, app_mod = client - conn.fetch.return_value = [ - _make_memory_row(id=5, content="[REDACTED]", is_sensitive=True), + conn.fetch.side_effect = [ + [_make_memory_row(id=5, content="[REDACTED]", is_sensitive=True)], # own + [], # individually shared + [], # tag-shared ] async with ac: