46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
import pytest
|
|
import tempfile
|
|
from pathlib import Path
|
|
from src import mcp_client
|
|
from src import beads_client
|
|
|
|
def test_bd_mcp_tools(tmp_path: Path):
|
|
# Setup mock workspace
|
|
workspace_dir = tmp_path / "workspace"
|
|
workspace_dir.mkdir()
|
|
|
|
# Configure mcp client allowlist
|
|
mcp_client.configure([{"path": str(workspace_dir)}], extra_base_dirs=[str(workspace_dir)])
|
|
|
|
# Initialize Beads repo manually to simulate state
|
|
bclient = beads_client.BeadsClient(workspace_dir)
|
|
bclient.init_repo()
|
|
|
|
# Tools should be registered
|
|
tools = mcp_client.get_tool_schemas()
|
|
tool_names = [t["name"] for t in tools]
|
|
assert "bd_create" in tool_names
|
|
assert "bd_update" in tool_names
|
|
assert "bd_list" in tool_names
|
|
|
|
# Test bd_create
|
|
resp = mcp_client.dispatch("bd_create", {"title": "First Bead", "description": "This is a test bead"})
|
|
assert "bead-1" in resp
|
|
|
|
# Test bd_list
|
|
list_resp = mcp_client.dispatch("bd_list", {})
|
|
assert "bead-1" in list_resp
|
|
assert "First Bead" in list_resp
|
|
|
|
# Test bd_ready
|
|
ready_resp = mcp_client.dispatch("bd_ready", {})
|
|
assert ready_resp == "READY"
|
|
|
|
# Test bd_update
|
|
update_resp = mcp_client.dispatch("bd_update", {"bead_id": "bead-1", "status": "completed"})
|
|
assert "bead-1" in update_resp
|
|
|
|
# Test bd_list after update
|
|
list_resp2 = mcp_client.dispatch("bd_list", {})
|
|
assert "Status: completed" in list_resp2
|