Add tests for shelly switch unique ids (#109617)

This commit is contained in:
J. Nick Koston 2024-02-04 11:23:33 -06:00 committed by GitHub
parent e35c7fde89
commit 8d4f32645d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,16 @@ async def test_block_device_services(hass: HomeAssistant, mock_block_device) ->
assert hass.states.get("switch.test_name_channel_1").state == STATE_OFF
async def test_block_device_unique_ids(hass: HomeAssistant, mock_block_device) -> None:
"""Test block device unique_ids."""
await init_integration(hass, 1)
registry = er.async_get(hass)
entry = registry.async_get("switch.test_name_channel_1")
assert entry
assert entry.unique_id == "123456789ABC-relay_0"
async def test_block_set_state_connection_error(
hass: HomeAssistant, mock_block_device, monkeypatch
) -> None:
@ -176,6 +186,18 @@ async def test_rpc_device_services(
assert hass.states.get("switch.test_switch_0").state == STATE_OFF
async def test_rpc_device_unique_ids(
hass: HomeAssistant, mock_rpc_device, monkeypatch
) -> None:
"""Test RPC device unique_ids."""
await init_integration(hass, 2)
registry = er.async_get(hass)
entry = registry.async_get("switch.test_switch_0")
assert entry
assert entry.unique_id == "123456789ABC-switch:0"
async def test_rpc_device_switch_type_lights_mode(
hass: HomeAssistant, mock_rpc_device, monkeypatch
) -> None: