Add type hints to integration tests (part 13) (#87998)
This commit is contained in:
parent
c557cd2b1e
commit
ea11a30a35
53 changed files with 798 additions and 404 deletions
|
@ -14,7 +14,8 @@ from homeassistant.const import (
|
|||
STATE_UNLOCKING,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.entity_registry import RegistryEntryHider
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
@ -36,7 +37,11 @@ def calls(hass):
|
|||
return async_mock_service(hass, "test", "automation")
|
||||
|
||||
|
||||
async def test_get_triggers(hass, device_registry, entity_registry):
|
||||
async def test_get_triggers(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test we get the expected triggers from a lock."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
|
@ -74,12 +79,12 @@ async def test_get_triggers(hass, device_registry, entity_registry):
|
|||
),
|
||||
)
|
||||
async def test_get_triggers_hidden_auxiliary(
|
||||
hass,
|
||||
device_registry,
|
||||
entity_registry,
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
hidden_by,
|
||||
entity_category,
|
||||
):
|
||||
) -> None:
|
||||
"""Test we get the expected triggers from a hidden or auxiliary entity."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
|
@ -112,7 +117,11 @@ async def test_get_triggers_hidden_auxiliary(
|
|||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
async def test_get_trigger_capabilities(hass, device_registry, entity_registry):
|
||||
async def test_get_trigger_capabilities(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test we get the expected capabilities from a lock."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
|
@ -139,7 +148,7 @@ async def test_get_trigger_capabilities(hass, device_registry, entity_registry):
|
|||
}
|
||||
|
||||
|
||||
async def test_if_fires_on_state_change(hass, calls):
|
||||
async def test_if_fires_on_state_change(hass: HomeAssistant, calls) -> None:
|
||||
"""Test for turn_on and turn_off triggers firing."""
|
||||
hass.states.async_set("lock.entity", STATE_UNLOCKED)
|
||||
|
||||
|
@ -207,7 +216,7 @@ async def test_if_fires_on_state_change(hass, calls):
|
|||
] == "unlocked - device - {} - locked - unlocked - None".format("lock.entity")
|
||||
|
||||
|
||||
async def test_if_fires_on_state_change_with_for(hass, calls):
|
||||
async def test_if_fires_on_state_change_with_for(hass: HomeAssistant, calls) -> None:
|
||||
"""Test for triggers firing with delay."""
|
||||
entity_id = f"{DOMAIN}.entity"
|
||||
hass.states.async_set(entity_id, STATE_UNLOCKED)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue