mirror of
https://github.com/meshtastic/python.git
synced 2026-01-15 11:18:05 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d205d8e9ba | ||
|
|
384ad456ae | ||
|
|
a99397468f |
@@ -119,6 +119,10 @@ def setPref(attributes, name, valStr):
|
|||||||
val = meshtastic.util.fromStr(valStr)
|
val = meshtastic.util.fromStr(valStr)
|
||||||
logging.debug(f'valStr:{valStr} val:{val}')
|
logging.debug(f'valStr:{valStr} val:{val}')
|
||||||
|
|
||||||
|
if snake_name == 'wifi_password' and len(valStr) < 8:
|
||||||
|
print(f"Warning: wifi_password must be 8 or more characters.")
|
||||||
|
return
|
||||||
|
|
||||||
enumType = field.enum_type
|
enumType = field.enum_type
|
||||||
# pylint: disable=C0123
|
# pylint: disable=C0123
|
||||||
if enumType and type(val) == str:
|
if enumType and type(val) == str:
|
||||||
|
|||||||
@@ -902,6 +902,27 @@ def test_main_set_valid_wifi_passwd(capsys):
|
|||||||
mo.assert_called()
|
mo.assert_called()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.unit
|
||||||
|
@pytest.mark.usefixtures("reset_globals")
|
||||||
|
def test_main_set_invalid_wifi_passwd(capsys):
|
||||||
|
"""Test --set with an invalid value (password must be 8 or more characters)"""
|
||||||
|
sys.argv = ['', '--set', 'wifi_password', '1234567']
|
||||||
|
Globals.getInstance().set_args(sys.argv)
|
||||||
|
|
||||||
|
mocked_node = MagicMock(autospec=Node)
|
||||||
|
|
||||||
|
iface = MagicMock(autospec=SerialInterface)
|
||||||
|
iface.getNode.return_value = mocked_node
|
||||||
|
|
||||||
|
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 not re.search(r'Set wifi_password to 1234567', out, re.MULTILINE)
|
||||||
|
assert re.search(r'Warning: wifi_password must be 8 or more characters.', out, re.MULTILINE)
|
||||||
|
assert err == ''
|
||||||
|
mo.assert_called()
|
||||||
|
|
||||||
@pytest.mark.unit
|
@pytest.mark.unit
|
||||||
@pytest.mark.usefixtures("reset_globals")
|
@pytest.mark.usefixtures("reset_globals")
|
||||||
def test_main_set_valid_camel_case(capsys):
|
def test_main_set_valid_camel_case(capsys):
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -12,7 +12,7 @@ with open("README.md", "r") as fh:
|
|||||||
# This call to setup() does all the work
|
# This call to setup() does all the work
|
||||||
setup(
|
setup(
|
||||||
name="meshtastic",
|
name="meshtastic",
|
||||||
version="1.2.91",
|
version="1.2.92",
|
||||||
description="Python API & client shell for talking to Meshtastic devices",
|
description="Python API & client shell for talking to Meshtastic devices",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user