Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fix proxy pytests (#2272)

Dev Khant8143f86be6e9
diff --git a/tests/test_proxy.py b/tests/test_proxy.py
index a41be267b..e3207a385 100644
--- a/tests/test_proxy.py
+++ b/tests/test_proxy.py
@@ -9,7 +9,9 @@ from mem0.proxy.main import Chat, Completions, Mem0
@pytest.fixture
def mock_memory_client():
- return Mock(spec=MemoryClient)
+ mock_client = Mock(spec=MemoryClient)
+ mock_client.user_email = None
+ return mock_client
@pytest.fixture
@@ -65,6 +67,7 @@ def test_completions_create(mock_memory_client, mock_litellm):
messages = [{"role": "user", "content": "Hello, how are you?"}]
mock_memory_client.search.return_value = [{"memory": "Some relevant memory"}]
mock_litellm.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]}
+ mock_litellm.supports_function_calling.return_value = True
response = completions.create(model="gpt-4o-mini", messages=messages, user_id="test_user", temperature=0.7)
@@ -89,6 +92,7 @@ def test_completions_create_with_system_message(mock_memory_client, mock_litellm
]
mock_memory_client.search.return_value = [{"memory": "Some relevant memory"}]
mock_litellm.completion.return_value = {"choices": [{"message": {"content": "I'm doing well, thank you!"}}]}
+ mock_litellm.supports_function_calling.return_value = True
completions.create(model="gpt-4o-mini", messages=messages, user_id="test_user")