Update i-j* tests to use entity & device registry fixtures (#103900)
This commit is contained in:
parent
be2cee228c
commit
92b3c0c96b
20 changed files with 199 additions and 151 deletions
|
@ -57,18 +57,20 @@ async def mock_connection(*args, **kwargs):
|
|||
return True
|
||||
|
||||
|
||||
async def test_lock_lock(hass: HomeAssistant) -> None:
|
||||
async def test_lock_lock(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test locking an Insteon lock device."""
|
||||
|
||||
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
|
||||
config_entry.add_to_hass(hass)
|
||||
registry_entity = er.async_get(hass)
|
||||
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
try:
|
||||
lock = registry_entity.async_get("lock.device_55_55_55_55_55_55")
|
||||
lock = entity_registry.async_get("lock.device_55_55_55_55_55_55")
|
||||
state = hass.states.get(lock.entity_id)
|
||||
assert state.state is STATE_UNLOCKED
|
||||
|
||||
|
@ -82,19 +84,21 @@ async def test_lock_lock(hass: HomeAssistant) -> None:
|
|||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_lock_unlock(hass: HomeAssistant) -> None:
|
||||
async def test_lock_unlock(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test locking an Insteon lock device."""
|
||||
|
||||
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
|
||||
config_entry.add_to_hass(hass)
|
||||
registry_entity = er.async_get(hass)
|
||||
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
devices["55.55.55"].groups[1].set_value(255)
|
||||
|
||||
try:
|
||||
lock = registry_entity.async_get("lock.device_55_55_55_55_55_55")
|
||||
lock = entity_registry.async_get("lock.device_55_55_55_55_55_55")
|
||||
state = hass.states.get(lock.entity_id)
|
||||
|
||||
assert state.state is STATE_LOCKED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue