|
18 | 18 | onNode, |
19 | 19 | onReceive, |
20 | 20 | tunnelMain, |
| 21 | + set_missing_flags_false, |
21 | 22 | ) |
22 | 23 | from meshtastic import mt_config |
23 | 24 |
|
@@ -1897,6 +1898,41 @@ def test_main_export_config(capsys): |
1897 | 1898 | # mo.assert_called() |
1898 | 1899 |
|
1899 | 1900 |
|
| 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 | + |
1900 | 1936 | @pytest.mark.unit |
1901 | 1937 | @pytest.mark.usefixtures("reset_mt_config") |
1902 | 1938 | def test_main_gpio_rd_no_gpio_channel(capsys): |
|
0 commit comments