import pytest
from fastmcp import Client
from mode_manager_mcp.simple_server import ModeManagerServer
@pytest.fixture()
def server(global_patch_and_tempdir: str) -> ModeManagerServer:
return ModeManagerServer(prompts_dir=global_patch_and_tempdir)
@pytest.mark.asyncio
async def test_create_instruction_endpoint(server: ModeManagerServer) -> None:
async with Client(server.app) as client:
result = await client.call_tool(
"create_instruction",
{
"instruction_name": "func_test.instructions.md",
"description": "desc",
"content": "content",
},
)
assert "Successfully created" in result.data or "Successfully created" in str(result)
@pytest.mark.asyncio
async def test_delete_instruction_endpoint(server: ModeManagerServer) -> None:
async with Client(server.app) as client:
result = await client.call_tool("delete_instruction", {"instruction_name": "func_test.instructions.md"})
assert "Successfully deleted" in result.data or "Successfully deleted" in str(result)