mirror of
https://github.com/meshtastic/python.git
synced 2026-04-26 10:03:40 -04:00
add option to configure just the owner short name
This commit is contained in:
@@ -425,6 +425,23 @@ def test_main_set_owner_to_bob(capsys):
|
||||
mo.assert_called()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.usefixtures("reset_globals")
|
||||
def test_main_set_owner_short_to_bob(capsys):
|
||||
"""Test --set-owner-short bob"""
|
||||
sys.argv = ['', '--set-owner-short', 'bob']
|
||||
Globals.getInstance().set_args(sys.argv)
|
||||
|
||||
iface = MagicMock(autospec=SerialInterface)
|
||||
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'Setting device owner short to bob', out, re.MULTILINE)
|
||||
assert err == ''
|
||||
mo.assert_called()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.usefixtures("reset_globals")
|
||||
def test_main_set_ham_to_KI123(capsys):
|
||||
|
||||
@@ -55,6 +55,15 @@ def test_setOwner_and_team(caplog):
|
||||
assert re.search(r'p.set_owner.team:1', caplog.text, re.MULTILINE)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_setOwnerShort(caplog):
|
||||
"""Test setOwner"""
|
||||
anode = Node('foo', 'bar', noProto=True)
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
anode.setOwner(long_name=None, short_name='123')
|
||||
assert re.search(r'p.set_owner.short_name:123:', caplog.text, re.MULTILINE)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_setOwner_no_short_name(caplog):
|
||||
"""Test setOwner"""
|
||||
|
||||
Reference in New Issue
Block a user