From 516082e2d3a17543018404a52682d70079768f40 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Mon, 6 Dec 2021 14:23:02 -0800 Subject: [PATCH] add smoke test for configure via yaml file --- README.md | 9 +++++++++ example_config.yaml | 4 ++-- meshtastic/test/test_smoke1.py | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 452995b..e88dfff 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,15 @@ Setting HAM ID to KI1345 and turning off encryption Writing modified channels to device ``` +## Changing multiple settings from a yaml file + +You can put parameters into a yaml file to update multiple values. See the example_config.yml. + +This is how you might call it: +``` +meshtastic --configure example_config.yaml +``` + ## FAQ/common problems This is a collection of common questions and answers from our friendly forum. diff --git a/example_config.yaml b/example_config.yaml index f85efc3..231b465 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -9,7 +9,7 @@ location: user_prefs: region: 1 - is_always_powered: true + is_always_powered: 'true' send_owner_interval: 2 screen_on_secs: 31536000 - wait_bluetooth_secs: 31536000 \ No newline at end of file + wait_bluetooth_secs: 31536000 diff --git a/meshtastic/test/test_smoke1.py b/meshtastic/test/test_smoke1.py index 72290db..9e57018 100644 --- a/meshtastic/test/test_smoke1.py +++ b/meshtastic/test/test_smoke1.py @@ -321,6 +321,24 @@ def test_smoke1_seturl_invalid_url(): assert re.search('Aborting', out, re.MULTILINE) +@pytest.mark.smoke1 +def test_smoke1_configure(): + """Test --configure""" + return_value, out = subprocess.getstatusoutput(f"meshtastic --configure example_config.yaml") + assert re.match(r'Connected to radio', out) + assert re.search('^Setting device owner to Bob TBeam', out, re.MULTILINE) + assert re.search('^Fixing altitude at 304 meters', out, re.MULTILINE) + assert re.search('^Fixing latitude at 35.8', out, re.MULTILINE) + assert re.search('^Fixing longitude at -93.8', out, re.MULTILINE) + assert re.search('^Setting device position', out, re.MULTILINE) + assert re.search('^Set region to 1', out, re.MULTILINE) + assert re.search('^Set is_always_powered to true', out, re.MULTILINE) + assert re.search('^Set send_owner_interval to 2', out, re.MULTILINE) + assert re.search('^Set screen_on_secs to 31536000', out, re.MULTILINE) + assert re.search('^Set wait_bluetooth_secs to 31536000', out, re.MULTILINE) + assert re.search('^Writing modified preferences to device', out, re.MULTILINE) + + @pytest.mark.smoke1 def test_smoke1_factory_reset(): """Test factory reset"""