subscribe to traceroute app pubsub topic (#471)

* subscribe to traceroute app pubsub topic

* cover missing unit test vectors
This commit is contained in:
l5y
2025-11-19 17:03:46 +01:00
committed by GitHub
parent db670fbb7c
commit c55f3a19e9
2 changed files with 25 additions and 0 deletions
+1
View File
@@ -36,6 +36,7 @@ _RECEIVE_TOPICS = (
"meshtastic.receive.TEXT_MESSAGE_APP",
"meshtastic.receive.REACTION_APP",
"meshtastic.receive.TELEMETRY_APP",
"meshtastic.receive.TRACEROUTE_APP",
)
+24
View File
@@ -224,6 +224,30 @@ def mesh_module(monkeypatch):
sys.modules.pop(module_name, None)
def test_subscribe_receive_topics_covers_all_handlers(mesh_module, monkeypatch):
mesh = mesh_module
daemon_mod = sys.modules["data.mesh_ingestor.daemon"]
recorded_calls: list[tuple[tuple[object, ...], dict[str, object]]] = []
class RecordingPub:
def subscribe(self, *args, **kwargs):
recorded_calls.append((args, kwargs))
monkeypatch.setattr(daemon_mod, "pub", RecordingPub())
subscribed_topics = mesh._subscribe_receive_topics()
expected_topics = list(mesh._RECEIVE_TOPICS)
assert subscribed_topics == expected_topics
assert len(recorded_calls) == len(expected_topics)
for (args, kwargs), topic in zip(recorded_calls, expected_topics):
assert not kwargs
assert args[0] is mesh.on_receive
assert args[1] == topic
def test_snapshot_interval_defaults_to_60_seconds(mesh_module):
mesh = mesh_module
assert mesh.SNAPSHOT_SECS == 60