mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
- Updated `handler_dispatcher.py` to streamline legacy runtime preparation and dispatching results. - Enhanced `loader.py` to simplify legacy plugin detection and manifest building. - Added tests for new HTTPClient and MetadataClient functionalities. - Introduced tests for legacy context metadata methods and legacy loader helpers. - Improved legacy runtime tests to cover new functionality and edge cases.
90 lines
2.8 KiB
Python
90 lines
2.8 KiB
Python
"""
|
|
Tests for clients/__init__.py - Module exports.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
class TestClientsModuleExports:
|
|
"""Tests for clients module exports."""
|
|
|
|
def test_exports_db_client(self):
|
|
"""clients module should export DBClient."""
|
|
from astrbot_sdk.clients import DBClient
|
|
|
|
assert DBClient is not None
|
|
|
|
def test_exports_llm_client(self):
|
|
"""clients module should export LLMClient."""
|
|
from astrbot_sdk.clients import LLMClient
|
|
|
|
assert LLMClient is not None
|
|
|
|
def test_exports_llm_response(self):
|
|
"""clients module should export LLMResponse."""
|
|
from astrbot_sdk.clients import LLMResponse
|
|
|
|
assert LLMResponse is not None
|
|
|
|
def test_exports_chat_message(self):
|
|
"""clients module should export ChatMessage."""
|
|
from astrbot_sdk.clients import ChatMessage
|
|
|
|
assert ChatMessage is not None
|
|
|
|
def test_exports_memory_client(self):
|
|
"""clients module should export MemoryClient."""
|
|
from astrbot_sdk.clients import MemoryClient
|
|
|
|
assert MemoryClient is not None
|
|
|
|
def test_exports_platform_client(self):
|
|
"""clients module should export PlatformClient."""
|
|
from astrbot_sdk.clients import PlatformClient
|
|
|
|
assert PlatformClient is not None
|
|
|
|
def test_all_exports_defined(self):
|
|
"""__all__ should contain all expected exports."""
|
|
from astrbot_sdk.clients import __all__
|
|
|
|
assert "DBClient" in __all__
|
|
assert "LLMClient" in __all__
|
|
assert "LLMResponse" in __all__
|
|
assert "ChatMessage" in __all__
|
|
assert "MemoryClient" in __all__
|
|
assert "PlatformClient" in __all__
|
|
assert "HTTPClient" in __all__
|
|
assert "MetadataClient" in __all__
|
|
assert "PluginMetadata" in __all__
|
|
|
|
def test_exports_http_client(self):
|
|
"""clients module should export HTTPClient."""
|
|
from astrbot_sdk.clients import HTTPClient
|
|
|
|
assert HTTPClient is not None
|
|
|
|
def test_exports_metadata_client(self):
|
|
"""clients module should export MetadataClient."""
|
|
from astrbot_sdk.clients import MetadataClient
|
|
|
|
assert MetadataClient is not None
|
|
|
|
def test_exports_plugin_metadata(self):
|
|
"""clients module should export PluginMetadata."""
|
|
from astrbot_sdk.clients import PluginMetadata
|
|
|
|
assert PluginMetadata is not None
|
|
|
|
def test_does_not_export_capability_proxy(self):
|
|
"""CapabilityProxy should not be in public exports."""
|
|
from astrbot_sdk.clients import __all__
|
|
|
|
assert "CapabilityProxy" not in __all__
|
|
|
|
def test_capability_proxy_importable_from_private(self):
|
|
"""CapabilityProxy should be importable from _proxy."""
|
|
from astrbot_sdk.clients._proxy import CapabilityProxy
|
|
|
|
assert CapabilityProxy is not None
|