mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-08-01 01:34:37 +02:00
Release v0.9.75 runtime and onboarding update
Ship the 0.9.75 source update with improved startup/runtime hardening, operator API key onboarding, Meshtastic MQTT controls, Infonet/MeshChat separation, desktop package versioning, and aircraft telemetry refinements. Also updates focused backend/frontend tests for node settings, Meshtastic MQTT settings, and desktop runtime behavior.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import importlib
|
||||
|
||||
|
||||
def test_meshtastic_mqtt_settings_redacts_secrets(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("SB_DATA_DIR", str(tmp_path))
|
||||
|
||||
from services import meshtastic_mqtt_settings
|
||||
|
||||
settings = importlib.reload(meshtastic_mqtt_settings)
|
||||
saved = settings.write_meshtastic_mqtt_settings(
|
||||
enabled=True,
|
||||
broker="mqtt.example.test",
|
||||
port=1884,
|
||||
username="mesh-user",
|
||||
password="mesh-pass",
|
||||
psk="001122",
|
||||
include_default_roots=False,
|
||||
extra_roots="EU,US",
|
||||
)
|
||||
redacted = settings.redacted_meshtastic_mqtt_settings(saved)
|
||||
|
||||
assert saved["password"] == "mesh-pass"
|
||||
assert saved["psk"] == "001122"
|
||||
assert redacted["enabled"] is True
|
||||
assert redacted["broker"] == "mqtt.example.test"
|
||||
assert redacted["port"] == 1884
|
||||
assert redacted["username"] == "mesh-user"
|
||||
assert redacted["has_password"] is True
|
||||
assert redacted["has_psk"] is True
|
||||
assert "password" not in redacted
|
||||
assert "psk" not in redacted
|
||||
assert settings.mqtt_connection_config() == ("mqtt.example.test", 1884, "mesh-user", "mesh-pass")
|
||||
assert settings.mqtt_bridge_enabled() is True
|
||||
assert settings.mqtt_psk_hex() == "001122"
|
||||
assert settings.mqtt_subscription_settings() == ("EU,US", "", False)
|
||||
|
||||
|
||||
def test_meshtastic_mqtt_settings_hide_public_defaults(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("SB_DATA_DIR", str(tmp_path))
|
||||
|
||||
from services import meshtastic_mqtt_settings
|
||||
|
||||
settings = importlib.reload(meshtastic_mqtt_settings)
|
||||
saved = settings.write_meshtastic_mqtt_settings(
|
||||
enabled=True,
|
||||
broker="mqtt.meshtastic.org",
|
||||
username="",
|
||||
password="",
|
||||
)
|
||||
redacted = settings.redacted_meshtastic_mqtt_settings(saved)
|
||||
|
||||
assert redacted["username"] == ""
|
||||
assert redacted["uses_default_credentials"] is True
|
||||
assert settings.mqtt_connection_config() == ("mqtt.meshtastic.org", 1883, "meshdev", "large4cats")
|
||||
@@ -0,0 +1,21 @@
|
||||
from services.mesh.meshtastic_topics import build_subscription_topics, known_roots, parse_topic_metadata
|
||||
|
||||
|
||||
def test_default_subscription_is_longfast_only():
|
||||
assert build_subscription_topics() == ["msh/US/2/e/LongFast/#"]
|
||||
assert known_roots() == ["US"]
|
||||
|
||||
|
||||
def test_extra_roots_are_longfast_only():
|
||||
assert build_subscription_topics(extra_roots="EU_868,ANZ") == [
|
||||
"msh/US/2/e/LongFast/#",
|
||||
"msh/EU_868/2/e/LongFast/#",
|
||||
"msh/ANZ/2/e/LongFast/#",
|
||||
]
|
||||
|
||||
|
||||
def test_parse_longfast_topic_root():
|
||||
meta = parse_topic_metadata("msh/US/2/e/LongFast/!12345678")
|
||||
assert meta["region"] == "US"
|
||||
assert meta["root"] == "US"
|
||||
assert meta["channel"] == "LongFast"
|
||||
@@ -7,9 +7,44 @@ def test_node_settings_roundtrip(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(node_settings, "_cache_ts", 0.0)
|
||||
|
||||
initial = node_settings.read_node_settings()
|
||||
disabled = node_settings.write_node_settings(enabled=False)
|
||||
updated = node_settings.write_node_settings(enabled=True)
|
||||
reread = node_settings.read_node_settings()
|
||||
|
||||
assert initial["enabled"] is False
|
||||
assert initial["enabled"] is True
|
||||
assert initial["operator_disabled"] is False
|
||||
assert disabled["enabled"] is False
|
||||
assert disabled["operator_disabled"] is True
|
||||
assert updated["enabled"] is True
|
||||
assert updated["operator_disabled"] is False
|
||||
assert reread["enabled"] is True
|
||||
|
||||
|
||||
def test_legacy_disabled_node_settings_auto_enable(tmp_path, monkeypatch):
|
||||
from services import node_settings
|
||||
|
||||
settings_path = tmp_path / "node.json"
|
||||
settings_path.write_text('{"enabled": false, "updated_at": 123}', encoding="utf-8")
|
||||
monkeypatch.setattr(node_settings, "NODE_FILE", settings_path)
|
||||
monkeypatch.setattr(node_settings, "_cache", None)
|
||||
monkeypatch.setattr(node_settings, "_cache_ts", 0.0)
|
||||
|
||||
reread = node_settings.read_node_settings()
|
||||
|
||||
assert reread["enabled"] is True
|
||||
assert reread["operator_disabled"] is False
|
||||
|
||||
|
||||
def test_explicit_operator_disabled_stays_disabled(tmp_path, monkeypatch):
|
||||
from services import node_settings
|
||||
|
||||
settings_path = tmp_path / "node.json"
|
||||
settings_path.write_text('{"enabled": false, "operator_disabled": true, "updated_at": 123}', encoding="utf-8")
|
||||
monkeypatch.setattr(node_settings, "NODE_FILE", settings_path)
|
||||
monkeypatch.setattr(node_settings, "_cache", None)
|
||||
monkeypatch.setattr(node_settings, "_cache_ts", 0.0)
|
||||
|
||||
reread = node_settings.read_node_settings()
|
||||
|
||||
assert reread["enabled"] is False
|
||||
assert reread["operator_disabled"] is True
|
||||
|
||||
Reference in New Issue
Block a user