Files
mulit-agent/mulit_agent/tests/test_full_access_tool.py
T

35 lines
1.0 KiB
Python

from mulit_agent_app.infrastructure.full_access_tool import FullAccessTool
def test_full_access_tool_runs_a_local_powershell_command():
tool = FullAccessTool()
result = tool.execute("task-1", "Write-Output full-access-ok")
assert result == "full-access-ok"
def test_full_access_tool_redacts_secrets_from_command_output():
tool = FullAccessTool()
result = tool.execute("task-2", "Write-Output 'api_key=must-not-leave-agent'")
assert "must-not-leave-agent" not in result
assert "[已脱敏]" in result
def test_full_access_tool_stages_and_removes_task_attachments():
from mulit_agent_app.domain.attachments import TaskAttachment
tool = FullAccessTool()
paths = tool.stage_attachments(
"test-staged-attachment",
(TaskAttachment("input.png", "image/png", "data:image/png;base64,aW1hZ2U="),),
)
assert len(paths) == 1
assert paths[0].name == "input.png"
assert paths[0].read_bytes() == b"image"
tool.cleanup_task_attachments("test-staged-attachment")
assert not paths[0].exists()