MCPcopy Create free account
hub / github.com/IBM/mcp-cli / _make_store

Function _make_store

tests/commands/memory/test_memory_command.py:154–183  ·  view source on GitHub ↗

Build a mock MemoryScopeStore.

()

Source from the content-addressed store, hash-verified

152
153
154def _make_store() -> MagicMock:
155 """Build a mock MemoryScopeStore."""
156 from mcp_cli.memory.models import MemoryEntry, MemoryScope
157
158 store = MagicMock()
159
160 ws_entry = MemoryEntry(
161 key="db_type",
162 content="postgresql",
163 )
164 gl_entry = MemoryEntry(
165 key="test_framework",
166 content="always use pytest for testing Python projects",
167 )
168
169 def _list(scope):
170 if scope == MemoryScope.WORKSPACE:
171 return [ws_entry]
172 elif scope == MemoryScope.GLOBAL:
173 return [gl_entry]
174 return []
175
176 store.list_entries.side_effect = _list
177
178 remembered = MemoryEntry(key="new_key", content="new content")
179 store.remember.return_value = remembered
180 store.forget.return_value = True
181 store.clear.return_value = 3
182
183 return store
184
185
186# ---------------------------------------------------------------------------

Callers 1

_make_chat_contextFunction · 0.70

Calls 1

MemoryEntryClass · 0.90

Tested by

no test coverage detected