Improve typing for calls fixture in tests (m-z) (#118350)

* Improve typing for `calls` fixture in tests (m-z)

* More

* More
This commit is contained in:
epenet 2024-05-29 09:30:41 +02:00 committed by GitHub
parent 0c38aa56f5
commit 98d24dd276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 433 additions and 250 deletions

View file

@ -11,7 +11,7 @@ from homeassistant.components.device_automation.exceptions import (
)
from homeassistant.components.nest import DOMAIN
from homeassistant.components.nest.events import NEST_EVENT
from homeassistant.core import HomeAssistant
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
@ -80,7 +80,7 @@ async def setup_automation(hass, device_id, trigger_type):
@pytest.fixture
def calls(hass):
def calls(hass: HomeAssistant) -> list[ServiceCall]:
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation")
@ -244,7 +244,7 @@ async def test_fires_on_camera_motion(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test camera_motion triggers firing."""
create_device.create(
@ -278,7 +278,7 @@ async def test_fires_on_camera_person(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test camera_person triggers firing."""
create_device.create(
@ -312,7 +312,7 @@ async def test_fires_on_camera_sound(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test camera_sound triggers firing."""
create_device.create(
@ -346,7 +346,7 @@ async def test_fires_on_doorbell_chime(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test doorbell_chime triggers firing."""
create_device.create(
@ -380,7 +380,7 @@ async def test_trigger_for_wrong_device_id(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test messages for the wrong device are ignored."""
create_device.create(
@ -413,7 +413,7 @@ async def test_trigger_for_wrong_event_type(
device_registry: dr.DeviceRegistry,
create_device: CreateDevice,
setup_platform: PlatformSetup,
calls,
calls: list[ServiceCall],
) -> None:
"""Test that messages for the wrong event type are ignored."""
create_device.create(
@ -444,7 +444,7 @@ async def test_trigger_for_wrong_event_type(
async def test_subscriber_automation(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
calls: list,
calls: list[ServiceCall],
create_device: CreateDevice,
setup_platform: PlatformSetup,
subscriber: FakeSubscriber,