Add type hints to integration tests (part 20) (#88179)
This commit is contained in:
parent
793e51ac76
commit
3a9adacdde
55 changed files with 537 additions and 292 deletions
|
@ -20,13 +20,16 @@ from homeassistant.components.cover import (
|
|||
from homeassistant.components.smartthings.const import DOMAIN, SIGNAL_SMARTTHINGS_UPDATE
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
|
||||
from .conftest import setup_platform
|
||||
|
||||
|
||||
async def test_entity_and_device_attributes(hass, device_factory):
|
||||
async def test_entity_and_device_attributes(
|
||||
hass: HomeAssistant, device_factory
|
||||
) -> None:
|
||||
"""Test the attributes of the entity are correct."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
@ -50,7 +53,7 @@ async def test_entity_and_device_attributes(hass, device_factory):
|
|||
assert entry.manufacturer == "Unavailable"
|
||||
|
||||
|
||||
async def test_open(hass, device_factory):
|
||||
async def test_open(hass: HomeAssistant, device_factory) -> None:
|
||||
"""Test the cover opens doors, garages, and shades successfully."""
|
||||
# Arrange
|
||||
devices = {
|
||||
|
@ -75,7 +78,7 @@ async def test_open(hass, device_factory):
|
|||
assert state.state == STATE_OPENING
|
||||
|
||||
|
||||
async def test_close(hass, device_factory):
|
||||
async def test_close(hass: HomeAssistant, device_factory) -> None:
|
||||
"""Test the cover closes doors, garages, and shades successfully."""
|
||||
# Arrange
|
||||
devices = {
|
||||
|
@ -100,7 +103,7 @@ async def test_close(hass, device_factory):
|
|||
assert state.state == STATE_CLOSING
|
||||
|
||||
|
||||
async def test_set_cover_position(hass, device_factory):
|
||||
async def test_set_cover_position(hass: HomeAssistant, device_factory) -> None:
|
||||
"""Test the cover sets to the specific position."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
@ -127,7 +130,9 @@ async def test_set_cover_position(hass, device_factory):
|
|||
assert device._api.post_device_command.call_count == 1 # type: ignore
|
||||
|
||||
|
||||
async def test_set_cover_position_unsupported(hass, device_factory):
|
||||
async def test_set_cover_position_unsupported(
|
||||
hass: HomeAssistant, device_factory
|
||||
) -> None:
|
||||
"""Test set position does nothing when not supported by device."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
@ -150,7 +155,7 @@ async def test_set_cover_position_unsupported(hass, device_factory):
|
|||
assert device._api.post_device_command.call_count == 0 # type: ignore
|
||||
|
||||
|
||||
async def test_update_to_open_from_signal(hass, device_factory):
|
||||
async def test_update_to_open_from_signal(hass: HomeAssistant, device_factory) -> None:
|
||||
"""Test the cover updates to open when receiving a signal."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
@ -168,7 +173,9 @@ async def test_update_to_open_from_signal(hass, device_factory):
|
|||
assert state.state == STATE_OPEN
|
||||
|
||||
|
||||
async def test_update_to_closed_from_signal(hass, device_factory):
|
||||
async def test_update_to_closed_from_signal(
|
||||
hass: HomeAssistant, device_factory
|
||||
) -> None:
|
||||
"""Test the cover updates to closed when receiving a signal."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
@ -186,7 +193,7 @@ async def test_update_to_closed_from_signal(hass, device_factory):
|
|||
assert state.state == STATE_CLOSED
|
||||
|
||||
|
||||
async def test_unload_config_entry(hass, device_factory):
|
||||
async def test_unload_config_entry(hass: HomeAssistant, device_factory) -> None:
|
||||
"""Test the lock is removed when the config entry is unloaded."""
|
||||
# Arrange
|
||||
device = device_factory(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue