Skip to content

Commit 0261313

Browse files
committed
add test
1 parent c1a6234 commit 0261313

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

meshtastic/tests/test_main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
onNode,
1919
onReceive,
2020
tunnelMain,
21+
set_missing_flags_false,
2122
)
2223
from meshtastic import mt_config
2324

@@ -1897,6 +1898,41 @@ def test_main_export_config(capsys):
18971898
# mo.assert_called()
18981899

18991900

1901+
@pytest.mark.unit
1902+
def test_set_missing_flags_false():
1903+
"""Test set_missing_flags_false() function"""
1904+
config = {
1905+
"bluetooth": {
1906+
"enabled": True
1907+
},
1908+
"lora": {
1909+
"txEnabled": True
1910+
}
1911+
}
1912+
1913+
false_defaults = {
1914+
("bluetooth", "enabled"),
1915+
("lora", "sx126xRxBoostedGain"),
1916+
("lora", "txEnabled"),
1917+
("lora", "usePreset"),
1918+
("position", "positionBroadcastSmartEnabled"),
1919+
("security", "serialEnabled"),
1920+
("mqtt", "encryptionEnabled"),
1921+
}
1922+
1923+
set_missing_flags_false(config, false_defaults)
1924+
1925+
# Preserved
1926+
assert config["bluetooth"]["enabled"] is True
1927+
assert config["lora"]["txEnabled"] is True
1928+
1929+
# Added
1930+
assert config["lora"]["usePreset"] is False
1931+
assert config["lora"]["sx126xRxBoostedGain"] is False
1932+
assert config["position"]["positionBroadcastSmartEnabled"] is False
1933+
assert config["security"]["serialEnabled"] is False
1934+
assert config["mqtt"]["encryptionEnabled"] is False
1935+
19001936
@pytest.mark.unit
19011937
@pytest.mark.usefixtures("reset_mt_config")
19021938
def test_main_gpio_rd_no_gpio_channel(capsys):

0 commit comments

Comments
 (0)