mirror of
https://github.com/meshtastic/python.git
synced 2026-04-17 21:42:20 -04:00
Remove --sendping as REPLY_APP portnum is disabled in firmware now
This commit is contained in:
@@ -394,17 +394,6 @@ def onConnected(interface):
|
||||
f"Warning: {channelIndex} is not a valid channel. Channel must not be DISABLED."
|
||||
)
|
||||
|
||||
if args.sendping:
|
||||
payload = str.encode("test string")
|
||||
print(f"Sending ping message to {args.dest}")
|
||||
interface.sendData(
|
||||
payload,
|
||||
args.dest,
|
||||
portNum=portnums_pb2.PortNum.REPLY_APP,
|
||||
wantAck=True,
|
||||
wantResponse=True,
|
||||
)
|
||||
|
||||
if args.traceroute:
|
||||
loraConfig = getattr(interface.localNode.localConfig, "lora")
|
||||
hopLimit = getattr(loraConfig, "hop_limit")
|
||||
@@ -1241,12 +1230,6 @@ def initParser():
|
||||
help="Send a text message. Can specify a destination '--dest' and/or channel index '--ch-index'.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--sendping",
|
||||
help="Send a ping message (which requests a reply)",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--traceroute",
|
||||
help="Traceroute from connected node to a destination. "
|
||||
|
||||
@@ -713,31 +713,6 @@ def test_main_sendtext_with_dest(capsys, caplog, iface_with_nodes):
|
||||
assert err == ""
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.usefixtures("reset_globals")
|
||||
def test_main_sendping(capsys):
|
||||
"""Test --sendping"""
|
||||
sys.argv = ["", "--sendping"]
|
||||
Globals.getInstance().set_args(sys.argv)
|
||||
|
||||
iface = MagicMock(autospec=SerialInterface)
|
||||
|
||||
def mock_sendData(payload, dest, portNum, wantAck, wantResponse):
|
||||
print("inside mocked sendData")
|
||||
print(f"{payload} {dest} {portNum} {wantAck} {wantResponse}")
|
||||
|
||||
iface.sendData.side_effect = mock_sendData
|
||||
|
||||
with patch("meshtastic.serial_interface.SerialInterface", return_value=iface) as mo:
|
||||
main()
|
||||
out, err = capsys.readouterr()
|
||||
assert re.search(r"Connected to radio", out, re.MULTILINE)
|
||||
assert re.search(r"Sending ping message", out, re.MULTILINE)
|
||||
assert re.search(r"inside mocked sendData", out, re.MULTILINE)
|
||||
assert err == ""
|
||||
mo.assert_called()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.usefixtures("reset_globals")
|
||||
def test_main_setlat(capsys):
|
||||
|
||||
@@ -40,15 +40,6 @@ def test_smoke1_info():
|
||||
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'."""
|
||||
|
||||
@@ -50,17 +50,6 @@ def test_smokevirt_info():
|
||||
assert return_value == 0
|
||||
|
||||
|
||||
@pytest.mark.smokevirt
|
||||
def test_smokevirt_sendping():
|
||||
"""Test --sendping"""
|
||||
return_value, out = subprocess.getstatusoutput(
|
||||
"meshtastic --host localhost --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.smokevirt
|
||||
def test_get_with_invalid_setting():
|
||||
"""Test '--get a_bad_setting'."""
|
||||
|
||||
Reference in New Issue
Block a user