Files
AstrBot/tests/unit/test_func_tool_manager.py
LIghtJUNction e16e5c7630 fix: resolve merge conflicts from upstream and fix tool conflict resolution
- ToolSet.add() now protects active tools from inactive overrides
- Add missing _has_meaningful_content() method in RespondStage
- Remove is_local=True from ExecuteShellTool (no longer supported)
- Fix ToolSet() missing namespace argument in get_full_tool_set()
- Rewrite tests to match new tool architecture (cron_tools, func_tool_manager, tool_conflict_resolution)
2026-04-15 20:45:11 +08:00

53 lines
1.6 KiB
Python

"""Tests for FunctionToolManager with new internal tools architecture."""
from astrbot.core.provider.func_tool_manager import FunctionToolManager
from astrbot.core.computer.computer_tool_provider import get_all_tools
def test_computer_tools_provider_returns_tools():
"""ComputerToolProvider should return a list of computer tools."""
tools = get_all_tools()
assert len(tools) > 0
names = [t.name for t in tools]
assert "astrbot_execute_shell" in names
def test_register_internal_tools_adds_tools_to_manager():
"""register_internal_tools should add computer tools to the manager."""
manager = FunctionToolManager()
# Should start empty
assert manager.get_func("astrbot_execute_shell") is None
# Register internal tools
manager.register_internal_tools()
# Should now have the shell tool
tool = manager.get_func("astrbot_execute_shell")
assert tool is not None
assert tool.name == "astrbot_execute_shell"
def test_manager_func_list_starts_empty():
"""func_list should start empty in new architecture."""
manager = FunctionToolManager()
assert manager.func_list == []
def test_register_internal_tools_does_not_duplicate():
"""Calling register_internal_tools twice should not duplicate tools."""
manager = FunctionToolManager()
manager.register_internal_tools()
first_tool = manager.get_func("astrbot_execute_shell")
assert first_tool is not None
# Register again
manager.register_internal_tools()
# Should still have the same tool (not duplicated)
second_tool = manager.get_func("astrbot_execute_shell")
assert second_tool is first_tool