mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add tests for shelly switch unique ids (#109617)
This commit is contained in:
parent
e35c7fde89
commit
8d4f32645d
@ -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
|
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(
|
async def test_block_set_state_connection_error(
|
||||||
hass: HomeAssistant, mock_block_device, monkeypatch
|
hass: HomeAssistant, mock_block_device, monkeypatch
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -176,6 +186,18 @@ async def test_rpc_device_services(
|
|||||||
assert hass.states.get("switch.test_switch_0").state == STATE_OFF
|
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(
|
async def test_rpc_device_switch_type_lights_mode(
|
||||||
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
hass: HomeAssistant, mock_rpc_device, monkeypatch
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user