mirror of
https://github.com/meshtastic/python.git
synced 2026-01-13 18:28:03 -05:00
rename to --export-config
This commit is contained in:
@@ -335,10 +335,10 @@ def onConnected(interface):
|
||||
print("Writing modified preferences to device")
|
||||
getNode().writeConfig()
|
||||
|
||||
if args.configure_dump:
|
||||
# dump out the configuration (the opposite of '--configure')
|
||||
if args.export_config:
|
||||
# export the configuration (the opposite of '--configure')
|
||||
closeNow = True
|
||||
configure_dump(interface)
|
||||
export_config(interface)
|
||||
|
||||
if args.seturl:
|
||||
closeNow = True
|
||||
@@ -520,8 +520,8 @@ def subscribe():
|
||||
# pub.subscribe(onNode, "meshtastic.node")
|
||||
|
||||
|
||||
def configure_dump(interface):
|
||||
"""Get info used in --configuration-dump"""
|
||||
def export_config(interface):
|
||||
"""used in--export-config"""
|
||||
owner = interface.getLongName()
|
||||
channel_url = interface.localNode.getURL()
|
||||
myinfo = interface.getMyNodeInfo()
|
||||
@@ -649,8 +649,8 @@ def initParser():
|
||||
action='append')
|
||||
|
||||
parser.add_argument(
|
||||
"--configure-dump",
|
||||
help="Dump the configuration in yaml(.yml) format.",
|
||||
"--export-config",
|
||||
help="Export the configuration in yaml(.yml) format.",
|
||||
action='store_true')
|
||||
|
||||
parser.add_argument(
|
||||
|
||||
@@ -8,7 +8,7 @@ import re
|
||||
from unittest.mock import patch, MagicMock
|
||||
import pytest
|
||||
|
||||
from meshtastic.__main__ import initParser, main, Globals, onReceive, onConnection, configure_dump
|
||||
from meshtastic.__main__ import initParser, main, Globals, onReceive, onConnection, export_config
|
||||
import meshtastic.radioconfig_pb2
|
||||
from ..serial_interface import SerialInterface
|
||||
from ..tcp_interface import TCPInterface
|
||||
@@ -1200,8 +1200,8 @@ def test_main_onConnection(reset_globals, capsys):
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_main_configure_dump(reset_globals, capsys):
|
||||
"""Test configure_dump"""
|
||||
def test_main_export_config(reset_globals, capsys):
|
||||
"""Test export_config"""
|
||||
iface = MagicMock(autospec=SerialInterface)
|
||||
with patch('meshtastic.serial_interface.SerialInterface', return_value=iface) as mo:
|
||||
mo.getLongName.return_value = 'foo'
|
||||
@@ -1214,7 +1214,7 @@ ls_secs: 300
|
||||
position_broadcast_smart: true
|
||||
fixed_position: true
|
||||
position_flags: 35"""
|
||||
configure_dump(mo)
|
||||
export_config(mo)
|
||||
out, err = capsys.readouterr()
|
||||
assert re.search(r'owner: foo', out, re.MULTILINE)
|
||||
assert re.search(r'channel_url: bar', out, re.MULTILINE)
|
||||
|
||||
Reference in New Issue
Block a user