| 10 | @pytest.mark.asyncio |
| 11 | @pytest.mark.mcp |
| 12 | async def test_terminal(): |
| 13 | async with Client(MCP_URL) as client: |
| 14 | |
| 15 | async def call_tool(tool_name: str, **kwargs) -> Dict[str, Any]: |
| 16 | res = await client.call_tool(tool_name, kwargs or {}) |
| 17 | return getattr(res, "data", None) or {} |
| 18 | |
| 19 | s1 = await call_tool("term_send", text="echo terminal_ok") |
| 20 | assert "error" not in s1, f"term_send failed: {s1}" |
| 21 | |
| 22 | r1 = await call_tool("term_read", lines=50) |
| 23 | assert "error" not in r1, f"term_read failed: {r1}" |
| 24 | assert "terminal_ok" in r1.get("output", ""), f"term_read missing echo: {r1}" |
| 25 | |
| 26 | r2 = await call_tool("shell_run", text="echo shellrun_ok") |
| 27 | assert "error" not in r2, f"shell_run failed: {r2}" |
| 28 | assert "shellrun_ok" in r2.get("output", ""), f"shell_run output mismatch: {r2}" |