mirror of
https://github.com/meshtastic/python.git
synced 2026-05-04 22:05:39 -04:00
fix enum listing; add tests for pref values
This commit is contained in:
@@ -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 latitude', 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 err == ''
|
||||
mo.assert_called()
|
||||
@@ -1963,6 +1964,27 @@ def test_main_setPref_valid_field_invalid_enum(capsys, caplog):
|
||||
setPref(prefs, 'charge_current', 'foo')
|
||||
out, err = capsys.readouterr()
|
||||
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 == ''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user