ria-toolkit-oss/tests/agent/test_hardware.py

30 lines
829 B
Python
Raw Normal View History

from ria_toolkit_oss.agent import hardware
from ria_toolkit_oss.sdr import detect_available
def test_detect_available_includes_mock():
drivers = detect_available()
assert "mock" in drivers
from ria_toolkit_oss.sdr.mock import MockSDR
assert drivers["mock"] is MockSDR
def test_available_devices_sorted_list():
devices = hardware.available_devices()
assert isinstance(devices, list)
assert devices == sorted(devices)
assert "mock" in devices
def test_heartbeat_payload_shape():
p = hardware.heartbeat_payload()
assert p["type"] == "heartbeat"
assert p["status"] == "idle"
assert "mock" in p["hardware"]
assert "app_id" not in p
p2 = hardware.heartbeat_payload(status="streaming", app_id="abc")
assert p2["status"] == "streaming"
assert p2["app_id"] == "abc"