mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-04 08:52:03 +02:00
Update tests with new out_path_hash_mode field and surface error on path hash mode set failure
This commit is contained in:
@@ -90,6 +90,7 @@ export interface Contact {
|
||||
flags: number;
|
||||
last_path: string | null;
|
||||
last_path_len: number;
|
||||
out_path_hash_mode: number;
|
||||
last_advert: number | null;
|
||||
lat: number | null;
|
||||
lon: number | null;
|
||||
|
||||
@@ -161,6 +161,27 @@ class TestUpdateRadioConfig:
|
||||
|
||||
assert exc.value.status_code == 400
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_propagates_radio_error_when_setting_path_hash_mode(self):
|
||||
mc = _mock_meshcore_with_info()
|
||||
mc.commands.set_path_hash_mode = AsyncMock(
|
||||
return_value=_radio_result(EventType.ERROR, {"error": "nope"})
|
||||
)
|
||||
|
||||
with (
|
||||
patch("app.routers.radio.require_connected", return_value=mc),
|
||||
patch.object(radio_manager, "_meshcore", mc),
|
||||
patch.object(radio_manager, "path_hash_mode_supported", True),
|
||||
patch.object(radio_manager, "path_hash_mode", 0),
|
||||
):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
await update_radio_config(RadioConfigUpdate(path_hash_mode=1))
|
||||
|
||||
assert exc.value.status_code == 500
|
||||
assert "Failed to set path hash mode" in str(exc.value.detail)
|
||||
assert radio_manager.path_hash_mode == 0
|
||||
mc.commands.send_appstart.assert_not_awaited()
|
||||
|
||||
|
||||
class TestPrivateKeyImport:
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user