Files
AstrBot/tests/dashboard/test_log.py
LIghtJUNction daee102c07 test: comprehensive import smoke tests for all dashboard routes
Coverage now includes:
session_management, config, knowledge_base, live_chat, persona,
tools, chat, conversation, open_api, backup, skills, t2i, cron,
plugin, chatui_project, stat, server, auth, subagent, update,
log, command
2026-04-29 08:19:38 +08:00

34 lines
1.0 KiB
Python

"""Import smoke tests for the log dashboard route module.
Verifies that all public classes and helper functions from ``log.py``
can be imported without errors.
"""
# ---------------------------------------------------------------------------
# log.py -- LogRoute and helper functions
# ---------------------------------------------------------------------------
from astrbot.dashboard.routes.log import (
LogRoute, # noqa: F401
_format_log_sse, # noqa: F401
_coerce_log_timestamp, # noqa: F401
)
def test_log_route_class():
assert LogRoute is not None
def test_format_log_sse():
log_entry = {"level": "INFO", "message": "hello"}
ts = 1234567890.0
result = _format_log_sse(log_entry, ts)
assert result.startswith(f"id: {ts}\n")
assert "hello" in result
def test_coerce_log_timestamp():
assert _coerce_log_timestamp(1234567890) == 1234567890.0
assert _coerce_log_timestamp("1234567890") == 1234567890.0
assert _coerce_log_timestamp("invalid") is None
assert _coerce_log_timestamp(None) is None