mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Increase test coverage in yale_smart_alarm (#132650)
This commit is contained in:
parent
f4e48c31bd
commit
4e2e6619d0
@ -455,10 +455,17 @@ async def test_options_flow(
|
|||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "init"
|
assert result["step_id"] == "init"
|
||||||
|
|
||||||
result = await hass.config_entries.options.async_configure(
|
with patch(
|
||||||
result["flow_id"],
|
"homeassistant.components.yale_smart_alarm.coordinator.YaleSmartAlarmClient",
|
||||||
user_input={"lock_code_digits": 6},
|
return_value=load_config_entry[1],
|
||||||
)
|
):
|
||||||
|
result = await hass.config_entries.options.async_configure(
|
||||||
|
result["flow_id"],
|
||||||
|
user_input={"lock_code_digits": 4},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["data"] == {"lock_code_digits": 6}
|
assert result["data"] == {"lock_code_digits": 4}
|
||||||
|
|
||||||
|
assert entry.state == config_entries.ConfigEntryState.LOADED
|
||||||
|
@ -8,8 +8,12 @@ import pytest
|
|||||||
from syrupy.assertion import SnapshotAssertion
|
from syrupy.assertion import SnapshotAssertion
|
||||||
from yalesmartalarmclient import YaleSmartAlarmData
|
from yalesmartalarmclient import YaleSmartAlarmData
|
||||||
|
|
||||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN, SERVICE_TURN_OFF
|
from homeassistant.components.switch import (
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, Platform
|
DOMAIN as SWITCH_DOMAIN,
|
||||||
|
SERVICE_TURN_OFF,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
|
)
|
||||||
|
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@ -44,3 +48,15 @@ async def test_switch(
|
|||||||
|
|
||||||
state = hass.states.get("switch.device1_autolock")
|
state = hass.states.get("switch.device1_autolock")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
await hass.services.async_call(
|
||||||
|
SWITCH_DOMAIN,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
|
{
|
||||||
|
ATTR_ENTITY_ID: "switch.device1_autolock",
|
||||||
|
},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
state = hass.states.get("switch.device1_autolock")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
Loading…
x
Reference in New Issue
Block a user