mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
634486107b
Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude <noreply@anthropic.com>
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""
|
|
Integration tests for read_note MCP tool.
|
|
|
|
Tests the full flow: MCP client -> MCP server -> FastAPI -> database
|
|
"""
|
|
|
|
import pytest
|
|
from fastmcp import Client
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_read_note_after_write(mcp_server, app):
|
|
"""Test read_note after write_note using real database."""
|
|
|
|
async with Client(mcp_server) as client:
|
|
# First write a note
|
|
write_result = await client.call_tool(
|
|
"write_note",
|
|
{
|
|
"title": "Test Note",
|
|
"folder": "test",
|
|
"content": "# Test Note\n\nThis is test content.",
|
|
"tags": "test,integration",
|
|
},
|
|
)
|
|
|
|
assert len(write_result) == 1
|
|
assert write_result[0].type == "text"
|
|
assert "Test Note.md" in write_result[0].text
|
|
|
|
# Then read it back
|
|
read_result = await client.call_tool(
|
|
"read_note",
|
|
{
|
|
"identifier": "Test Note",
|
|
},
|
|
)
|
|
|
|
assert len(read_result) == 1
|
|
assert read_result[0].type == "text"
|
|
result_text = read_result[0].text
|
|
|
|
# Should contain the note content and metadata
|
|
assert "# Test Note" in result_text
|
|
assert "This is test content." in result_text
|
|
assert "test/test-note" in result_text # permalink
|