mirror of
https://github.com/meshtastic/python.git
synced 2025-12-31 11:57:57 -05:00
add set-ham and pos-fields tests
This commit is contained in:
@@ -763,7 +763,7 @@ def initParser():
|
||||
"--setlon", help="Set device longitude (allows use without GPS)")
|
||||
|
||||
parser.add_argument(
|
||||
"--pos-fields", help="Specify position message fields (? for more info)",
|
||||
"--pos-fields", help="Specify position message fields. Use '0' for list of valid values. Can pass multiple values as a space separated list like this: '--pos-fields POS_ALTITUDE POS_ALT_MSL'",
|
||||
nargs="*", action="store")
|
||||
|
||||
parser.add_argument("--debug", help="Show API library debug log messages",
|
||||
|
||||
@@ -48,6 +48,23 @@ def test_smoke1_sendping():
|
||||
assert return_value == 0
|
||||
|
||||
|
||||
@pytest.mark.smoke1
|
||||
def test_smoke1_pos_fields():
|
||||
"""Test --pos-fields (with some values POS_ALTITUDE POS_ALT_MSL POS_BATTERY)"""
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --pos-fields POS_ALTITUDE POS_ALT_MSL POS_BATTERY')
|
||||
assert re.match(r'Connected to radio', out)
|
||||
assert re.search(r'^Setting position fields to 35', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
# pause for the radio
|
||||
time.sleep(PAUSE_AFTER_COMMAND)
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --pos-fields')
|
||||
assert re.match(r'Connected to radio', out)
|
||||
assert re.search(r'POS_ALTITUDE', out, re.MULTILINE)
|
||||
assert re.search(r'POS_ALT_MSL', out, re.MULTILINE)
|
||||
assert re.search(r'POS_BATTERY', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
|
||||
|
||||
@pytest.mark.smoke1
|
||||
def test_smoke1_test():
|
||||
"""Test --test
|
||||
@@ -367,6 +384,21 @@ def test_smoke1_configure():
|
||||
assert re.search('^Writing modified preferences to device', out, re.MULTILINE)
|
||||
|
||||
|
||||
@pytest.mark.smoke1
|
||||
def test_smoke1_set_ham():
|
||||
"""Test --set-ham
|
||||
Note: Do a factory reset after this setting so it is very short-lived.
|
||||
"""
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --set-ham KI1234')
|
||||
assert re.search(r'Setting HAM ID', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
# pause for the radio
|
||||
time.sleep(PAUSE_AFTER_REBOOT)
|
||||
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
||||
assert re.search(r'Owner: KI1234', out, re.MULTILINE)
|
||||
assert return_value == 0
|
||||
|
||||
|
||||
@pytest.mark.smoke1
|
||||
def test_smoke1_factory_reset():
|
||||
"""Test factory reset"""
|
||||
|
||||
Reference in New Issue
Block a user