Files
AstrBot/tests/dashboard/test_plugin_tools.py
LIghtJUNction dcaaf6286a test: comprehensive test coverage and type fixes
- Add 100+ new test files covering provider sources, platform adapters,
  agent runners, star/plugin system, knowledge base, core utils,
  pipeline, computer tools, builtin commands, and dashboard routes
- Fix Python type errors in sqlite.py (col() wrappers for SQLModel),
  astr_agent_tool_exec, core_lifecycle, star context/manager
- Fix TypeScript strict mode errors across 30+ dashboard Vue files
- Add import smoke tests, auth roundtrip, startup tests
- Add compile-all check and CLI entry test for AUR compatibility
- Restore BotMessageAccumulator and helpers lost in merge
2026-04-29 06:29:56 +08:00

61 lines
1.8 KiB
Python

"""Import smoke tests for plugin and tools route modules.
Verifies that all public classes, standalone functions, and exceptions
from ``plugin.py`` and ``tools.py`` can be imported without errors.
"""
# ---------------------------------------------------------------------------
# plugin.py — PluginRoute, RegistrySource and helpers
# ---------------------------------------------------------------------------
from astrbot.dashboard.routes.plugin import (
PluginRoute, # noqa: F401
RegistrySource, # noqa: F401
PLUGIN_UPDATE_CONCURRENCY, # noqa: F401
PLUGIN_ROUTE_DEFINITIONS, # noqa: F401
)
def test_plugin_route_class():
assert PluginRoute is not None
def test_registry_source_dataclass():
from dataclasses import fields
assert fields(RegistrySource)
def test_plugin_update_concurrency_value():
assert isinstance(PLUGIN_UPDATE_CONCURRENCY, int)
def test_plugin_route_definitions_is_list():
assert isinstance(PLUGIN_ROUTE_DEFINITIONS, tuple)
# ---------------------------------------------------------------------------
# tools.py — ToolsRoute, EmptyMcpServersError, _extract_mcp_server_config
# ---------------------------------------------------------------------------
from astrbot.dashboard.routes.tools import (
EmptyMcpServersError, # noqa: F401
ToolsRoute, # noqa: F401
DEFAULT_MCP_CONFIG, # noqa: F401
_extract_mcp_server_config, # noqa: F401
)
def test_tools_route_class():
assert ToolsRoute is not None
def test_empty_mcp_servers_error():
assert issubclass(EmptyMcpServersError, ValueError)
def test_default_mcp_config():
assert DEFAULT_MCP_CONFIG == {"mcpServers": {}}
def test_extract_mcp_server_config_is_callable():
assert callable(_extract_mcp_server_config)