26 lines
838 B
Python
26 lines
838 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from lumaops_backend.connectors.base import DeviceState, RGBColor
|
|
from lumaops_backend.connectors.mock import MockOpenRGBAdapter
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_mock_connector_contract() -> None:
|
|
connector = MockOpenRGBAdapter()
|
|
await connector.start()
|
|
health = await connector.test_connection()
|
|
assert health.connected is True
|
|
devices = await connector.discover()
|
|
assert devices
|
|
device = devices[0]
|
|
before = await connector.get_state(device.external_id)
|
|
assert before.colors
|
|
after = await connector.set_state(
|
|
device.external_id,
|
|
DeviceState(power=True, colors=[RGBColor(red=10, green=20, blue=30)]),
|
|
)
|
|
assert after.colors == [RGBColor(red=10, green=20, blue=30)]
|
|
await connector.stop()
|