feat(bridge): add wifi/serial bridge runtime and UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
40
tests/test_bridge_wifi_connect.py
Normal file
40
tests/test_bridge_wifi_connect.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Tests for bridge serial connect profile handling."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
|
||||
|
||||
def test_connect_bridge_profile_serial(monkeypatch):
|
||||
from util import bridge_runtime
|
||||
|
||||
calls = {}
|
||||
|
||||
async def fake_connect_serial(profile, settings):
|
||||
calls["profile"] = profile
|
||||
calls["settings"] = settings
|
||||
return True, ""
|
||||
|
||||
monkeypatch.setattr(bridge_runtime, "connect_bridge_serial", fake_connect_serial)
|
||||
|
||||
class _Settings(dict):
|
||||
def save(self):
|
||||
pass
|
||||
|
||||
settings = _Settings({"bridge_serial_port": ""})
|
||||
profile = {
|
||||
"transport": "serial",
|
||||
"serial_port": "/dev/ttyUSB0",
|
||||
"serial_baudrate": 921600,
|
||||
}
|
||||
|
||||
ok, err = asyncio.run(bridge_runtime.connect_bridge_profile(profile, settings))
|
||||
assert ok is True
|
||||
assert err == ""
|
||||
assert calls["profile"]["serial_port"] == "/dev/ttyUSB0"
|
||||
Reference in New Issue
Block a user