feat(bridge): add wifi/serial bridge runtime and UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
35
tests/test_update_groups.py
Normal file
35
tests/test_update_groups.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Tests for pushing group membership to all ESP-NOW devices."""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
|
||||
|
||||
def test_push_groups_all_espnow_devices(monkeypatch):
|
||||
from util import espnow_registry
|
||||
|
||||
class _Devices:
|
||||
def items(self):
|
||||
return [
|
||||
("aabbccddeeff", {"transport": "espnow"}),
|
||||
("wifi-1", {"transport": "wifi", "address": "192.168.1.1"}),
|
||||
]
|
||||
|
||||
pushed = []
|
||||
|
||||
async def fake_push(mac):
|
||||
pushed.append(mac)
|
||||
return True
|
||||
|
||||
monkeypatch.setattr(espnow_registry, "Device", _Devices)
|
||||
monkeypatch.setattr(espnow_registry, "push_groups_to_mac", fake_push)
|
||||
|
||||
result = asyncio.run(espnow_registry.push_groups_all_espnow_devices())
|
||||
assert result["ok"] is True
|
||||
assert result["sent"] == 1
|
||||
assert result["total"] == 1
|
||||
assert pushed == ["aabbccddeeff"]
|
||||
Reference in New Issue
Block a user