mirror of
https://github.com/meshtastic/python.git
synced 2025-12-30 19:37:52 -05:00
1822 lines
90 KiB
HTML
1822 lines
90 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
|
<meta name="generator" content="pdoc 0.10.0" />
|
|
<title>meshtastic.tests.test_smoke1 API documentation</title>
|
|
<meta name="description" content="Meshtastic smoke tests with a single device via USB" />
|
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
|
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
|
|
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
|
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
|
|
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
|
|
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<article id="content">
|
|
<header>
|
|
<h1 class="title">Module <code>meshtastic.tests.test_smoke1</code></h1>
|
|
</header>
|
|
<section id="section-intro">
|
|
<p>Meshtastic smoke tests with a single device via USB</p>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">"""Meshtastic smoke tests with a single device via USB"""
|
|
import re
|
|
import subprocess
|
|
import time
|
|
import os
|
|
|
|
# Do not like using hard coded sleeps, but it probably makes
|
|
# sense to pause for the radio at apprpriate times
|
|
import pytest
|
|
|
|
from ..util import findPorts
|
|
|
|
# seconds to pause after running a meshtastic command
|
|
PAUSE_AFTER_COMMAND = 2
|
|
PAUSE_AFTER_REBOOT = 7
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_reboot():
|
|
"""Test reboot"""
|
|
return_value, _ = subprocess.getstatusoutput('meshtastic --reboot')
|
|
assert return_value == 0
|
|
# pause for the radio to reset (10 seconds for the pause, and a few more seconds to be back up)
|
|
time.sleep(18)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_info():
|
|
"""Test --info"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert re.search(r'^My info', out, re.MULTILINE)
|
|
assert re.search(r'^Nodes in mesh', out, re.MULTILINE)
|
|
assert re.search(r'^Preferences', out, re.MULTILINE)
|
|
assert re.search(r'^Channels', out, re.MULTILINE)
|
|
assert re.search(r'^ PRIMARY', out, re.MULTILINE)
|
|
assert re.search(r'^Primary channel URL', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_sendping():
|
|
"""Test --sendping"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --sendping')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Sending ping message', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_get_with_invalid_setting():
|
|
"""Test '--get a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get a_bad_setting')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_set_with_invalid_setting():
|
|
"""Test '--set a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set a_bad_setting foo')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_ch_set_with_invalid_settingpatch_find_ports():
|
|
"""Test '--ch-set with a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set invalid_setting foo --ch-index 0')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
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_with_arg_but_no_hardware():
|
|
"""Test --test
|
|
Note: Since only one device is connected, it will not do much.
|
|
"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --test')
|
|
assert re.search(r'^Warning: Must have at least two devices', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_debug():
|
|
"""Test --debug"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info --debug')
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert re.search(r'^DEBUG:root', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_seriallog_to_file():
|
|
"""Test --seriallog to a file creates a file"""
|
|
filename = 'tmpoutput.txt'
|
|
if os.path.exists(f"{filename}"):
|
|
os.remove(f"{filename}")
|
|
return_value, _ = subprocess.getstatusoutput(f'meshtastic --info --seriallog {filename}')
|
|
assert os.path.exists(f"{filename}")
|
|
assert return_value == 0
|
|
os.remove(f"{filename}")
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_qr():
|
|
"""Test --qr"""
|
|
filename = 'tmpqr'
|
|
if os.path.exists(f"{filename}"):
|
|
os.remove(f"{filename}")
|
|
return_value, _ = subprocess.getstatusoutput(f'meshtastic --qr > {filename}')
|
|
assert os.path.exists(f"{filename}")
|
|
# not really testing that a valid qr code is created, just that the file size
|
|
# is reasonably big enough for a qr code
|
|
assert os.stat(f"{filename}").st_size > 20000
|
|
assert return_value == 0
|
|
os.remove(f"{filename}")
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_nodes():
|
|
"""Test --nodes"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --nodes')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^│ N │ User', out, re.MULTILINE)
|
|
assert re.search(r'^│ 1 │', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_send_hello():
|
|
"""Test --sendtext hello"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --sendtext hello')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Sending text message hello to \^all', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_port():
|
|
"""Test --port"""
|
|
# first, get the ports
|
|
ports = findPorts()
|
|
# hopefully there is just one
|
|
assert len(ports) == 1
|
|
port = ports[0]
|
|
return_value, out = subprocess.getstatusoutput(f'meshtastic --port {port} --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_set_is_router_true():
|
|
"""Test --set is_router true"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router true')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set is_router to true', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
assert re.search(r'^is_router: True', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_set_location_info():
|
|
"""Test --setlat, --setlon and --setalt """
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --setlat 32.7767 --setlon -96.7970 --setalt 1337')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Fixing altitude', out, re.MULTILINE)
|
|
assert re.search(r'^Fixing latitude', out, re.MULTILINE)
|
|
assert re.search(r'^Fixing longitude', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out2 = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'1337', out2, re.MULTILINE)
|
|
assert re.search(r'32.7767', out2, re.MULTILINE)
|
|
assert re.search(r'-96.797', out2, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_set_is_router_false():
|
|
"""Test --set is_router false"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router false')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set is_router to false', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
assert re.search(r'^is_router: False', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_set_owner():
|
|
"""Test --set-owner name"""
|
|
# make sure the owner is not Joe
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-owner Bob')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting device owner to Bob', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'Owner: Joe', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-owner Joe')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting device owner to Joe', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'Owner: Joe', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_set_team():
|
|
"""Test --set-team """
|
|
# unset the team
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-team CLEAR')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting team to CLEAR', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-team CYAN')
|
|
assert re.search(r'Setting team to CYAN', 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'CYAN', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_values():
|
|
"""Test --ch-longslow, --ch-longfast, --ch-mediumslow, --ch-mediumsfast,
|
|
--ch-shortslow, and --ch-shortfast arguments
|
|
"""
|
|
exp = {
|
|
'--ch-longslow': 'Bw125Cr48Sf4096',
|
|
# TODO: not sure why these fail thru tests, but ok manually
|
|
#'--ch-longfast': 'Bw31_25Cr48Sf512',
|
|
#'--ch-mediumslow': 'Bw250Cr46Sf2048',
|
|
#'--ch-mediumfast': 'Bw250Cr47Sf1024',
|
|
# TODO '--ch-shortslow': '?',
|
|
'--ch-shortfast': 'Bw500Cr45Sf128'
|
|
}
|
|
|
|
for key, val in exp.items():
|
|
print(key, val)
|
|
return_value, out = subprocess.getstatusoutput(f'meshtastic {key}')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio (might reboot)
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(val, out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_name():
|
|
"""Test --ch-set name"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name MyChannel')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name MyChannel --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set name to MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_downlink_and_uplink():
|
|
"""Test -ch-set downlink_enabled X and --ch-set uplink_enabled X"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled false --ch-set uplink_enabled false')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled false --ch-set uplink_enabled false --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'uplinkEnabled', out, re.MULTILINE)
|
|
assert not re.search(r'downlinkEnabled', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled true --ch-set uplink_enabled true --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set downlink_enabled to true', out, re.MULTILINE)
|
|
assert re.search(r'^Set uplink_enabled to true', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'uplinkEnabled', out, re.MULTILINE)
|
|
assert re.search(r'downlinkEnabled', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_add_and_ch_del():
|
|
"""Test --ch-add"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-index 1 --ch-del')
|
|
assert re.search(r'Deleting channel 1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
# make sure the secondar channel is not there
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert not re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert not re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_enable_and_disable():
|
|
"""Test --ch-enable and --ch-disable"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure they need to specify a --ch-index
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable')
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'DISABLED', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-enable --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_del_a_disabled_non_primary_channel():
|
|
"""Test --ch-del will work on a disabled non-primary channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure they need to specify a --ch-index
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable')
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert not re.search(r'DISABLED', out, re.MULTILINE)
|
|
assert not re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert not re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_delete_primary_channel():
|
|
"""Test that we cannot delete the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 0')
|
|
assert re.search(r'Warning: Cannot delete primary channel', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_disable_primary_channel():
|
|
"""Test that we cannot disable the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable --ch-index 0')
|
|
assert re.search(r'Warning: Cannot enable', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_enable_primary_channel():
|
|
"""Test that we cannot enable the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-enable --ch-index 0')
|
|
assert re.search(r'Warning: Cannot enable', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ensure_ch_del_second_of_three_channels():
|
|
"""Test that when we delete the 2nd of 3 channels, that it deletes the correct channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ensure_ch_del_third_of_three_channels():
|
|
"""Test that when we delete the 3rd of 3 channels, that it deletes the correct channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_modem_config():
|
|
"""Test --ch-set modem_config"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config Bw31_25Cr48Sf512')
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config Bw31_25Cr48Sf512 --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set modem_config to Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_seturl_default():
|
|
"""Test --seturl with default value"""
|
|
# set some channel value so we no longer have a default channel
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name foo --ch-index 0')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure we no longer have a default primary channel
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search('CgUYAyIBAQ', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
url = "https://www.meshtastic.org/d/#CgUYAyIBAQ"
|
|
return_value, out = subprocess.getstatusoutput(f"meshtastic --seturl {url}")
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search('CgUYAyIBAQ', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_seturl_invalid_url():
|
|
"""Test --seturl with invalid url"""
|
|
# Note: This url is no longer a valid url.
|
|
url = "https://www.meshtastic.org/c/#GAMiENTxuzogKQdZ8Lz_q89Oab8qB0RlZmF1bHQ="
|
|
return_value, out = subprocess.getstatusoutput(f"meshtastic --seturl {url}")
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search('Warning: There were no settings', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_configure():
|
|
"""Test --configure"""
|
|
_ , 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)
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
|
|
|
|
@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_set_wifi_settings():
|
|
"""Test --set wifi_ssid and --set wifi_password"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set wifi_ssid "some_ssid" --set wifi_password "temp1234"')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set wifi_ssid to some_ssid', out, re.MULTILINE)
|
|
assert re.search(r'^Set wifi_password to temp1234', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get wifi_ssid --get wifi_password')
|
|
assert re.search(r'^wifi_ssid: some_ssid', out, re.MULTILINE)
|
|
assert re.search(r'^wifi_password: sekrit', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
|
|
|
|
@pytest.mark.smoke1
|
|
def test_smoke1_factory_reset():
|
|
"""Test factory reset"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set factory_reset true')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set factory_reset to true', out, re.MULTILINE)
|
|
assert re.search(r'^Writing modified preferences to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# NOTE: The radio may not be responsive after this, may need to do a manual reboot
|
|
# by pressing the button</code></pre>
|
|
</details>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
<section>
|
|
<h2 class="section-title" id="header-functions">Functions</h2>
|
|
<dl>
|
|
<dt id="meshtastic.tests.test_smoke1.test_ch_set_with_invalid_settingpatch_find_ports"><code class="name flex">
|
|
<span>def <span class="ident">test_ch_set_with_invalid_settingpatch_find_ports</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test '–ch-set with a_bad_setting'.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_ch_set_with_invalid_settingpatch_find_ports():
|
|
"""Test '--ch-set with a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set invalid_setting foo --ch-index 0')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_get_with_invalid_setting"><code class="name flex">
|
|
<span>def <span class="ident">test_get_with_invalid_setting</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test '–get a_bad_setting'.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_get_with_invalid_setting():
|
|
"""Test '--get a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get a_bad_setting')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_set_with_invalid_setting"><code class="name flex">
|
|
<span>def <span class="ident">test_set_with_invalid_setting</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test '–set a_bad_setting'.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_set_with_invalid_setting():
|
|
"""Test '--set a_bad_setting'."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set a_bad_setting foo')
|
|
assert re.search(r'Choices in sorted order', out)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_delete_primary_channel"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_attempt_to_delete_primary_channel</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test that we cannot delete the PRIMARY channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_delete_primary_channel():
|
|
"""Test that we cannot delete the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 0')
|
|
assert re.search(r'Warning: Cannot delete primary channel', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_disable_primary_channel"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_attempt_to_disable_primary_channel</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test that we cannot disable the PRIMARY channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_disable_primary_channel():
|
|
"""Test that we cannot disable the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable --ch-index 0')
|
|
assert re.search(r'Warning: Cannot enable', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_enable_primary_channel"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_attempt_to_enable_primary_channel</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test that we cannot enable the PRIMARY channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_attempt_to_enable_primary_channel():
|
|
"""Test that we cannot enable the PRIMARY channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-enable --ch-index 0')
|
|
assert re.search(r'Warning: Cannot enable', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_add_and_ch_del"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_add_and_ch_del</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-add</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_add_and_ch_del():
|
|
"""Test --ch-add"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-index 1 --ch-del')
|
|
assert re.search(r'Deleting channel 1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
# make sure the secondar channel is not there
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert not re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert not re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_del_a_disabled_non_primary_channel"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_del_a_disabled_non_primary_channel</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-del will work on a disabled non-primary channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_del_a_disabled_non_primary_channel():
|
|
"""Test --ch-del will work on a disabled non-primary channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure they need to specify a --ch-index
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable')
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert not re.search(r'DISABLED', out, re.MULTILINE)
|
|
assert not re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert not re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_enable_and_disable"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_enable_and_disable</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-enable and –ch-disable</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_enable_and_disable():
|
|
"""Test --ch-enable and --ch-disable"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing')
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure they need to specify a --ch-index
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable')
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-disable --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'DISABLED', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-enable --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_set_downlink_and_uplink"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_set_downlink_and_uplink</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test -ch-set downlink_enabled X and –ch-set uplink_enabled X</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_downlink_and_uplink():
|
|
"""Test -ch-set downlink_enabled X and --ch-set uplink_enabled X"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled false --ch-set uplink_enabled false')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled false --ch-set uplink_enabled false --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'uplinkEnabled', out, re.MULTILINE)
|
|
assert not re.search(r'downlinkEnabled', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set downlink_enabled true --ch-set uplink_enabled true --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set downlink_enabled to true', out, re.MULTILINE)
|
|
assert re.search(r'^Set uplink_enabled to true', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'uplinkEnabled', out, re.MULTILINE)
|
|
assert re.search(r'downlinkEnabled', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_set_modem_config"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_set_modem_config</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-set modem_config</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_modem_config():
|
|
"""Test --ch-set modem_config"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config Bw31_25Cr48Sf512')
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set modem_config Bw31_25Cr48Sf512 --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set modem_config to Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'Bw31_25Cr48Sf512', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_set_name"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_set_name</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-set name</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_set_name():
|
|
"""Test --ch-set name"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name MyChannel')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Warning: Need to specify', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name MyChannel --ch-index 0')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set name to MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'MyChannel', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ch_values"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ch_values</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –ch-longslow, –ch-longfast, –ch-mediumslow, –ch-mediumsfast,
|
|
–ch-shortslow, and –ch-shortfast arguments</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ch_values():
|
|
"""Test --ch-longslow, --ch-longfast, --ch-mediumslow, --ch-mediumsfast,
|
|
--ch-shortslow, and --ch-shortfast arguments
|
|
"""
|
|
exp = {
|
|
'--ch-longslow': 'Bw125Cr48Sf4096',
|
|
# TODO: not sure why these fail thru tests, but ok manually
|
|
#'--ch-longfast': 'Bw31_25Cr48Sf512',
|
|
#'--ch-mediumslow': 'Bw250Cr46Sf2048',
|
|
#'--ch-mediumfast': 'Bw250Cr47Sf1024',
|
|
# TODO '--ch-shortslow': '?',
|
|
'--ch-shortfast': 'Bw500Cr45Sf128'
|
|
}
|
|
|
|
for key, val in exp.items():
|
|
print(key, val)
|
|
return_value, out = subprocess.getstatusoutput(f'meshtastic {key}')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'Writing modified channels to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio (might reboot)
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(val, out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_configure"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_configure</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –configure</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_configure():
|
|
"""Test --configure"""
|
|
_ , 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)
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_debug"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_debug</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –debug</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_debug():
|
|
"""Test --debug"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info --debug')
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert re.search(r'^DEBUG:root', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_second_of_three_channels"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ensure_ch_del_second_of_three_channels</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test that when we delete the 2nd of 3 channels, that it deletes the correct channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ensure_ch_del_second_of_three_channels():
|
|
"""Test that when we delete the 2nd of 3 channels, that it deletes the correct channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_third_of_three_channels"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_ensure_ch_del_third_of_three_channels</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test that when we delete the 3rd of 3 channels, that it deletes the correct channel.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_ensure_ch_del_third_of_three_channels():
|
|
"""Test that when we delete the 3rd of 3 channels, that it deletes the correct channel."""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'SECONDARY', out, re.MULTILINE)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-add testing2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing2', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 2')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'testing1', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-del --ch-index 1')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_factory_reset"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_factory_reset</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test factory reset</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_factory_reset():
|
|
"""Test factory reset"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set factory_reset true')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set factory_reset to true', out, re.MULTILINE)
|
|
assert re.search(r'^Writing modified preferences to device', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# NOTE: The radio may not be responsive after this, may need to do a manual reboot
|
|
# by pressing the button</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_info"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_info</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –info</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_info():
|
|
"""Test --info"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert re.search(r'^My info', out, re.MULTILINE)
|
|
assert re.search(r'^Nodes in mesh', out, re.MULTILINE)
|
|
assert re.search(r'^Preferences', out, re.MULTILINE)
|
|
assert re.search(r'^Channels', out, re.MULTILINE)
|
|
assert re.search(r'^ PRIMARY', out, re.MULTILINE)
|
|
assert re.search(r'^Primary channel URL', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_nodes"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_nodes</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –nodes</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_nodes():
|
|
"""Test --nodes"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --nodes')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^│ N │ User', out, re.MULTILINE)
|
|
assert re.search(r'^│ 1 │', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_port"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_port</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –port</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_port():
|
|
"""Test --port"""
|
|
# first, get the ports
|
|
ports = findPorts()
|
|
# hopefully there is just one
|
|
assert len(ports) == 1
|
|
port = ports[0]
|
|
return_value, out = subprocess.getstatusoutput(f'meshtastic --port {port} --info')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Owner', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_pos_fields"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_pos_fields</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –pos-fields (with some values POS_ALTITUDE POS_ALT_MSL POS_BATTERY)</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@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</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_qr"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_qr</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –qr</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_qr():
|
|
"""Test --qr"""
|
|
filename = 'tmpqr'
|
|
if os.path.exists(f"{filename}"):
|
|
os.remove(f"{filename}")
|
|
return_value, _ = subprocess.getstatusoutput(f'meshtastic --qr > {filename}')
|
|
assert os.path.exists(f"{filename}")
|
|
# not really testing that a valid qr code is created, just that the file size
|
|
# is reasonably big enough for a qr code
|
|
assert os.stat(f"{filename}").st_size > 20000
|
|
assert return_value == 0
|
|
os.remove(f"{filename}")</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_reboot"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_reboot</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test reboot</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_reboot():
|
|
"""Test reboot"""
|
|
return_value, _ = subprocess.getstatusoutput('meshtastic --reboot')
|
|
assert return_value == 0
|
|
# pause for the radio to reset (10 seconds for the pause, and a few more seconds to be back up)
|
|
time.sleep(18)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_send_hello"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_send_hello</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –sendtext hello</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_send_hello():
|
|
"""Test --sendtext hello"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --sendtext hello')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Sending text message hello to \^all', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_sendping"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_sendping</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –sendping</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_sendping():
|
|
"""Test --sendping"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --sendping')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Sending ping message', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_seriallog_to_file"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_seriallog_to_file</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –seriallog to a file creates a file</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_seriallog_to_file():
|
|
"""Test --seriallog to a file creates a file"""
|
|
filename = 'tmpoutput.txt'
|
|
if os.path.exists(f"{filename}"):
|
|
os.remove(f"{filename}")
|
|
return_value, _ = subprocess.getstatusoutput(f'meshtastic --info --seriallog {filename}')
|
|
assert os.path.exists(f"{filename}")
|
|
assert return_value == 0
|
|
os.remove(f"{filename}")</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_ham"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_ham</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set-ham
|
|
Note: Do a factory reset after this setting so it is very short-lived.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@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</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_is_router_false"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_is_router_false</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set is_router false</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_is_router_false():
|
|
"""Test --set is_router false"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router false')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set is_router to false', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
assert re.search(r'^is_router: False', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_is_router_true"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_is_router_true</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set is_router true</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_is_router_true():
|
|
"""Test --set is_router true"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set is_router true')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set is_router to true', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get is_router')
|
|
assert re.search(r'^is_router: True', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_location_info"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_location_info</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –setlat, –setlon and –setalt</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_location_info():
|
|
"""Test --setlat, --setlon and --setalt """
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --setlat 32.7767 --setlon -96.7970 --setalt 1337')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Fixing altitude', out, re.MULTILINE)
|
|
assert re.search(r'^Fixing latitude', out, re.MULTILINE)
|
|
assert re.search(r'^Fixing longitude', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out2 = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'1337', out2, re.MULTILINE)
|
|
assert re.search(r'32.7767', out2, re.MULTILINE)
|
|
assert re.search(r'-96.797', out2, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_owner"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_owner</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set-owner name</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_owner():
|
|
"""Test --set-owner name"""
|
|
# make sure the owner is not Joe
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-owner Bob')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting device owner to Bob', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search(r'Owner: Joe', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-owner Joe')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting device owner to Joe', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search(r'Owner: Joe', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_team"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_team</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set-team</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_team():
|
|
"""Test --set-team """
|
|
# unset the team
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-team CLEAR')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Setting team to CLEAR', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_REBOOT)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set-team CYAN')
|
|
assert re.search(r'Setting team to CYAN', 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'CYAN', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_set_wifi_settings"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_set_wifi_settings</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –set wifi_ssid and –set wifi_password</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_set_wifi_settings():
|
|
"""Test --set wifi_ssid and --set wifi_password"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --set wifi_ssid "some_ssid" --set wifi_password "temp1234"')
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search(r'^Set wifi_ssid to some_ssid', out, re.MULTILINE)
|
|
assert re.search(r'^Set wifi_password to temp1234', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --get wifi_ssid --get wifi_password')
|
|
assert re.search(r'^wifi_ssid: some_ssid', out, re.MULTILINE)
|
|
assert re.search(r'^wifi_password: sekrit', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_seturl_default"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_seturl_default</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –seturl with default value</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_seturl_default():
|
|
"""Test --seturl with default value"""
|
|
# set some channel value so we no longer have a default channel
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --ch-set name foo --ch-index 0')
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
# ensure we no longer have a default primary channel
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert not re.search('CgUYAyIBAQ', out, re.MULTILINE)
|
|
assert return_value == 0
|
|
url = "https://www.meshtastic.org/d/#CgUYAyIBAQ"
|
|
return_value, out = subprocess.getstatusoutput(f"meshtastic --seturl {url}")
|
|
assert re.match(r'Connected to radio', out)
|
|
assert return_value == 0
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --info')
|
|
assert re.search('CgUYAyIBAQ', out, re.MULTILINE)
|
|
assert return_value == 0</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_seturl_invalid_url"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_seturl_invalid_url</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –seturl with invalid url</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_seturl_invalid_url():
|
|
"""Test --seturl with invalid url"""
|
|
# Note: This url is no longer a valid url.
|
|
url = "https://www.meshtastic.org/c/#GAMiENTxuzogKQdZ8Lz_q89Oab8qB0RlZmF1bHQ="
|
|
return_value, out = subprocess.getstatusoutput(f"meshtastic --seturl {url}")
|
|
assert re.match(r'Connected to radio', out)
|
|
assert re.search('Warning: There were no settings', out, re.MULTILINE)
|
|
assert return_value == 1
|
|
# pause for the radio
|
|
time.sleep(PAUSE_AFTER_COMMAND)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.tests.test_smoke1.test_smoke1_test_with_arg_but_no_hardware"><code class="name flex">
|
|
<span>def <span class="ident">test_smoke1_test_with_arg_but_no_hardware</span></span>(<span>)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Test –test
|
|
Note: Since only one device is connected, it will not do much.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">@pytest.mark.smoke1
|
|
def test_smoke1_test_with_arg_but_no_hardware():
|
|
"""Test --test
|
|
Note: Since only one device is connected, it will not do much.
|
|
"""
|
|
return_value, out = subprocess.getstatusoutput('meshtastic --test')
|
|
assert re.search(r'^Warning: Must have at least two devices', out, re.MULTILINE)
|
|
assert return_value == 1</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
</article>
|
|
<nav id="sidebar">
|
|
<h1>Index</h1>
|
|
<div class="toc">
|
|
<ul></ul>
|
|
</div>
|
|
<ul id="index">
|
|
<li><h3>Super-module</h3>
|
|
<ul>
|
|
<li><code><a title="meshtastic.tests" href="index.html">meshtastic.tests</a></code></li>
|
|
</ul>
|
|
</li>
|
|
<li><h3><a href="#header-functions">Functions</a></h3>
|
|
<ul class="">
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_ch_set_with_invalid_settingpatch_find_ports" href="#meshtastic.tests.test_smoke1.test_ch_set_with_invalid_settingpatch_find_ports">test_ch_set_with_invalid_settingpatch_find_ports</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_get_with_invalid_setting" href="#meshtastic.tests.test_smoke1.test_get_with_invalid_setting">test_get_with_invalid_setting</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_set_with_invalid_setting" href="#meshtastic.tests.test_smoke1.test_set_with_invalid_setting">test_set_with_invalid_setting</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_delete_primary_channel" href="#meshtastic.tests.test_smoke1.test_smoke1_attempt_to_delete_primary_channel">test_smoke1_attempt_to_delete_primary_channel</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_disable_primary_channel" href="#meshtastic.tests.test_smoke1.test_smoke1_attempt_to_disable_primary_channel">test_smoke1_attempt_to_disable_primary_channel</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_attempt_to_enable_primary_channel" href="#meshtastic.tests.test_smoke1.test_smoke1_attempt_to_enable_primary_channel">test_smoke1_attempt_to_enable_primary_channel</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_add_and_ch_del" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_add_and_ch_del">test_smoke1_ch_add_and_ch_del</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_del_a_disabled_non_primary_channel" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_del_a_disabled_non_primary_channel">test_smoke1_ch_del_a_disabled_non_primary_channel</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_enable_and_disable" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_enable_and_disable">test_smoke1_ch_enable_and_disable</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_set_downlink_and_uplink" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_set_downlink_and_uplink">test_smoke1_ch_set_downlink_and_uplink</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_set_modem_config" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_set_modem_config">test_smoke1_ch_set_modem_config</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_set_name" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_set_name">test_smoke1_ch_set_name</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ch_values" href="#meshtastic.tests.test_smoke1.test_smoke1_ch_values">test_smoke1_ch_values</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_configure" href="#meshtastic.tests.test_smoke1.test_smoke1_configure">test_smoke1_configure</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_debug" href="#meshtastic.tests.test_smoke1.test_smoke1_debug">test_smoke1_debug</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_second_of_three_channels" href="#meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_second_of_three_channels">test_smoke1_ensure_ch_del_second_of_three_channels</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_third_of_three_channels" href="#meshtastic.tests.test_smoke1.test_smoke1_ensure_ch_del_third_of_three_channels">test_smoke1_ensure_ch_del_third_of_three_channels</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_factory_reset" href="#meshtastic.tests.test_smoke1.test_smoke1_factory_reset">test_smoke1_factory_reset</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_info" href="#meshtastic.tests.test_smoke1.test_smoke1_info">test_smoke1_info</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_nodes" href="#meshtastic.tests.test_smoke1.test_smoke1_nodes">test_smoke1_nodes</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_port" href="#meshtastic.tests.test_smoke1.test_smoke1_port">test_smoke1_port</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_pos_fields" href="#meshtastic.tests.test_smoke1.test_smoke1_pos_fields">test_smoke1_pos_fields</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_qr" href="#meshtastic.tests.test_smoke1.test_smoke1_qr">test_smoke1_qr</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_reboot" href="#meshtastic.tests.test_smoke1.test_smoke1_reboot">test_smoke1_reboot</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_send_hello" href="#meshtastic.tests.test_smoke1.test_smoke1_send_hello">test_smoke1_send_hello</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_sendping" href="#meshtastic.tests.test_smoke1.test_smoke1_sendping">test_smoke1_sendping</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_seriallog_to_file" href="#meshtastic.tests.test_smoke1.test_smoke1_seriallog_to_file">test_smoke1_seriallog_to_file</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_ham" href="#meshtastic.tests.test_smoke1.test_smoke1_set_ham">test_smoke1_set_ham</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_is_router_false" href="#meshtastic.tests.test_smoke1.test_smoke1_set_is_router_false">test_smoke1_set_is_router_false</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_is_router_true" href="#meshtastic.tests.test_smoke1.test_smoke1_set_is_router_true">test_smoke1_set_is_router_true</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_location_info" href="#meshtastic.tests.test_smoke1.test_smoke1_set_location_info">test_smoke1_set_location_info</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_owner" href="#meshtastic.tests.test_smoke1.test_smoke1_set_owner">test_smoke1_set_owner</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_team" href="#meshtastic.tests.test_smoke1.test_smoke1_set_team">test_smoke1_set_team</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_set_wifi_settings" href="#meshtastic.tests.test_smoke1.test_smoke1_set_wifi_settings">test_smoke1_set_wifi_settings</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_seturl_default" href="#meshtastic.tests.test_smoke1.test_smoke1_seturl_default">test_smoke1_seturl_default</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_seturl_invalid_url" href="#meshtastic.tests.test_smoke1.test_smoke1_seturl_invalid_url">test_smoke1_seturl_invalid_url</a></code></li>
|
|
<li><code><a title="meshtastic.tests.test_smoke1.test_smoke1_test_with_arg_but_no_hardware" href="#meshtastic.tests.test_smoke1.test_smoke1_test_with_arg_but_no_hardware">test_smoke1_test_with_arg_but_no_hardware</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</main>
|
|
<footer id="footer">
|
|
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
</footer>
|
|
</body>
|
|
</html> |