mirror of
https://github.com/meshtastic/python.git
synced 2026-01-16 19:58:04 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4955ab8df2 | ||
|
|
de39c98e50 | ||
|
|
51378bb0eb |
@@ -14,3 +14,4 @@ user_prefs:
|
|||||||
send_owner_interval: 2
|
send_owner_interval: 2
|
||||||
screen_on_secs: 31536000
|
screen_on_secs: 31536000
|
||||||
wait_bluetooth_secs: 31536000
|
wait_bluetooth_secs: 31536000
|
||||||
|
location_share: 'LocEnabled'
|
||||||
|
|||||||
@@ -134,10 +134,8 @@ def setPref(attributes, name, valStr):
|
|||||||
print(f"Choices in sorted order are:")
|
print(f"Choices in sorted order are:")
|
||||||
names = []
|
names = []
|
||||||
for f in enumType.values:
|
for f in enumType.values:
|
||||||
tmp_name = f'{f.name}'
|
# Note: We must use the value of the enum (regardless if camel or snake case)
|
||||||
if Globals.getInstance().get_camel_case():
|
names.append(f'{f.name}')
|
||||||
tmp_name = meshtastic.util.snake_to_camel(tmp_name)
|
|
||||||
names.append(name)
|
|
||||||
for temp_name in sorted(names):
|
for temp_name in sorted(names):
|
||||||
print(f" {temp_name}")
|
print(f" {temp_name}")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -893,6 +893,7 @@ def test_main_configure_with_snake_case(capsys):
|
|||||||
assert re.search(r'Fixing altitude', out, re.MULTILINE)
|
assert re.search(r'Fixing altitude', out, re.MULTILINE)
|
||||||
assert re.search(r'Fixing latitude', out, re.MULTILINE)
|
assert re.search(r'Fixing latitude', out, re.MULTILINE)
|
||||||
assert re.search(r'Fixing longitude', out, re.MULTILINE)
|
assert re.search(r'Fixing longitude', out, re.MULTILINE)
|
||||||
|
assert re.search(r'Set location_share to LocEnabled', out, re.MULTILINE)
|
||||||
assert re.search(r'Writing modified preferences', out, re.MULTILINE)
|
assert re.search(r'Writing modified preferences', out, re.MULTILINE)
|
||||||
assert err == ''
|
assert err == ''
|
||||||
mo.assert_called()
|
mo.assert_called()
|
||||||
@@ -1963,6 +1964,27 @@ def test_main_setPref_valid_field_invalid_enum(capsys, caplog):
|
|||||||
setPref(prefs, 'charge_current', 'foo')
|
setPref(prefs, 'charge_current', 'foo')
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert re.search(r'charge_current does not have an enum called foo', out, re.MULTILINE)
|
assert re.search(r'charge_current does not have an enum called foo', out, re.MULTILINE)
|
||||||
|
assert re.search(r'Choices in sorted order are', out, re.MULTILINE)
|
||||||
|
assert re.search(r'MA100', out, re.MULTILINE)
|
||||||
|
assert re.search(r'MA280', out, re.MULTILINE)
|
||||||
|
assert err == ''
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.unit
|
||||||
|
@pytest.mark.usefixtures("reset_globals")
|
||||||
|
def test_main_setPref_valid_field_invalid_enum_where_enums_are_camel_cased_values(capsys, caplog):
|
||||||
|
"""Test setPref() with a valid field but invalid enum value"""
|
||||||
|
|
||||||
|
radioConfig = RadioConfig()
|
||||||
|
prefs = radioConfig.preferences
|
||||||
|
|
||||||
|
with caplog.at_level(logging.DEBUG):
|
||||||
|
setPref(prefs, 'location_share', 'foo')
|
||||||
|
out, err = capsys.readouterr()
|
||||||
|
assert re.search(r'location_share does not have an enum called foo', out, re.MULTILINE)
|
||||||
|
assert re.search(r'Choices in sorted order are', out, re.MULTILINE)
|
||||||
|
assert re.search(r'LocDisabled', out, re.MULTILINE)
|
||||||
|
assert re.search(r'LocEnabled', out, re.MULTILINE)
|
||||||
assert err == ''
|
assert err == ''
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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.56",
|
version="1.2.57",
|
||||||
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