mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-04-01 04:55:40 +00:00
- Added new settings for the topology engine in `config.ini.example` to support legacy, shadow, and new modes. - Updated documentation to include details on the probabilistic topology engine and its configuration options. - Enhanced `MeshCoreBot` to initialize the topology engine and log its status. - Introduced new database tables for shadow topology inference, ghost nodes, and model metrics in `RepeaterManager`. - Modified `PathCommand` to utilize the topology engine for repeater selection and comparison telemetry. - Updated web viewer templates to display topology engine mode and enable topology validation features. - Added JavaScript functions to handle data mode switching between legacy and model graphs.
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Unit tests for WebViewerCommand.
|
|
"""
|
|
|
|
from unittest.mock import AsyncMock, Mock
|
|
|
|
import pytest
|
|
|
|
from modules.commands.webviewer_command import WebViewerCommand
|
|
from modules.models import MeshMessage
|
|
|
|
|
|
def _make_message(content: str = "webviewer status") -> MeshMessage:
|
|
return MeshMessage(content=content, sender_id="tester", sender_pubkey="aa" * 32, is_dm=True)
|
|
|
|
|
|
@pytest.mark.unit
|
|
@pytest.mark.asyncio
|
|
async def test_webviewer_status_includes_topology_mode(command_mock_bot):
|
|
command_mock_bot.config.add_section("Path_Command")
|
|
command_mock_bot.config.set("Path_Command", "topology_engine_mode", "shadow")
|
|
|
|
integration = Mock()
|
|
integration.enabled = True
|
|
integration.running = True
|
|
integration.host = "127.0.0.1"
|
|
integration.port = 8080
|
|
integration.bot_integration = None
|
|
command_mock_bot.web_viewer_integration = integration
|
|
|
|
cmd = WebViewerCommand(command_mock_bot)
|
|
cmd.send_response = AsyncMock(return_value=True)
|
|
|
|
msg = _make_message("webviewer status")
|
|
await cmd._handle_status(msg)
|
|
|
|
assert cmd.send_response.called
|
|
payload = cmd.send_response.call_args.args[1]
|
|
assert "topology_mode: shadow" in payload
|
|
assert "topology_validation_page_expected: True" in payload
|