Files
basicmachines-co-basic-memory/test-int/mcp/test_read_note_integration.py
Paul Hernandez 634486107b feat: v0.13.0 pre (#122)
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude <noreply@anthropic.com>
2025-06-03 01:00:40 -05:00

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