e79bc2d291
- 删除 polymarket_wallet_activity_watcher.py(914行)及 runtime_coordinator 调度 - 移除 LGBM / Polymarket 价格层 / Groq / prewarm 等 v1.7.0 已废弃功能的文档引用 - 清理 6 个死文档链接,更新文档索引和版本日期 - 移除 POLYMARKET_WALLET_ACTIVITY_* / PREWARM_* 等废弃环境变量 Directive: 文档与代码同步清理,无功能变更 Tested: pytest tests/test_bot_runtime_coordinator.py pass Confidence: high
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from src.bot.runtime_coordinator import RuntimeStatus, StartupCoordinator, render_runtime_status_html
|
|
|
|
|
|
class DummyBot:
|
|
pass
|
|
|
|
|
|
def test_startup_coordinator_respects_disable_flags(monkeypatch):
|
|
monkeypatch.setenv("POLYGON_WALLET_WATCH_ENABLED", "false")
|
|
monkeypatch.delenv("TELEGRAM_CHAT_ID", raising=False)
|
|
|
|
coordinator = StartupCoordinator(
|
|
bot=DummyBot(),
|
|
config={},
|
|
command_access_mode="group_member",
|
|
protected_commands=["/city", "/deb"],
|
|
required_group_chat_id="-1001234567890",
|
|
)
|
|
runtime = coordinator.start_all()
|
|
loop_map = runtime.loop_map()
|
|
|
|
assert loop_map["polygon_wallet_watch"].reason == "disabled_by_env"
|
|
|
|
|
|
def test_render_runtime_status_html_contains_key_fields():
|
|
runtime = RuntimeStatus(
|
|
started_at="2026-03-12 00:00:00 UTC",
|
|
command_access_mode="group_member",
|
|
protected_commands=["/city", "/deb"],
|
|
required_group_chat_id="-1001234567890",
|
|
loops=[],
|
|
)
|
|
html = render_runtime_status_html(runtime)
|
|
|
|
assert "Bot 启动诊断" in html
|
|
assert "命令准入" in html
|
|
assert "/city, /deb" in html
|