Add type hints to integration tests (part 15) (#88006)
This commit is contained in:
parent
6c23d6abfe
commit
50cbabb2d8
51 changed files with 896 additions and 427 deletions
|
@ -11,6 +11,7 @@ from homeassistant.components.device_tracker.legacy import (
|
|||
YAML_DEVICES,
|
||||
)
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_fire_mqtt_message
|
||||
|
@ -34,7 +35,7 @@ async def setup_comp(hass, mqtt_mock_entry_with_yaml_config):
|
|||
os.remove(yaml_devices)
|
||||
|
||||
|
||||
async def test_ensure_device_tracker_platform_validation(hass):
|
||||
async def test_ensure_device_tracker_platform_validation(hass: HomeAssistant) -> None:
|
||||
"""Test if platform validation was done."""
|
||||
|
||||
async def mock_setup_scanner(hass, config, see, discovery_info=None):
|
||||
|
@ -56,7 +57,7 @@ async def test_ensure_device_tracker_platform_validation(hass):
|
|||
assert mock_sp.call_count == 1
|
||||
|
||||
|
||||
async def test_json_message(hass):
|
||||
async def test_json_message(hass: HomeAssistant) -> None:
|
||||
"""Test json location message."""
|
||||
dev_id = "zanzito"
|
||||
topic = "location/zanzito"
|
||||
|
@ -74,7 +75,9 @@ async def test_json_message(hass):
|
|||
assert state.attributes.get("longitude") == 1.0
|
||||
|
||||
|
||||
async def test_non_json_message(hass, caplog):
|
||||
async def test_non_json_message(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Test receiving a non JSON message."""
|
||||
dev_id = "zanzito"
|
||||
topic = "location/zanzito"
|
||||
|
@ -93,7 +96,9 @@ async def test_non_json_message(hass, caplog):
|
|||
assert "Error parsing JSON payload: home" in caplog.text
|
||||
|
||||
|
||||
async def test_incomplete_message(hass, caplog):
|
||||
async def test_incomplete_message(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Test receiving an incomplete message."""
|
||||
dev_id = "zanzito"
|
||||
topic = "location/zanzito"
|
||||
|
@ -115,7 +120,7 @@ async def test_incomplete_message(hass, caplog):
|
|||
)
|
||||
|
||||
|
||||
async def test_single_level_wildcard_topic(hass):
|
||||
async def test_single_level_wildcard_topic(hass: HomeAssistant) -> None:
|
||||
"""Test single level wildcard topic."""
|
||||
dev_id = "zanzito"
|
||||
subscription = "location/+/zanzito"
|
||||
|
@ -134,7 +139,7 @@ async def test_single_level_wildcard_topic(hass):
|
|||
assert state.attributes.get("longitude") == 1.0
|
||||
|
||||
|
||||
async def test_multi_level_wildcard_topic(hass):
|
||||
async def test_multi_level_wildcard_topic(hass: HomeAssistant) -> None:
|
||||
"""Test multi level wildcard topic."""
|
||||
dev_id = "zanzito"
|
||||
subscription = "location/#"
|
||||
|
@ -153,7 +158,7 @@ async def test_multi_level_wildcard_topic(hass):
|
|||
assert state.attributes.get("longitude") == 1.0
|
||||
|
||||
|
||||
async def test_single_level_wildcard_topic_not_matching(hass):
|
||||
async def test_single_level_wildcard_topic_not_matching(hass: HomeAssistant) -> None:
|
||||
"""Test not matching single level wildcard topic."""
|
||||
dev_id = "zanzito"
|
||||
entity_id = f"{DT_DOMAIN}.{dev_id}"
|
||||
|
@ -171,7 +176,7 @@ async def test_single_level_wildcard_topic_not_matching(hass):
|
|||
assert hass.states.get(entity_id) is None
|
||||
|
||||
|
||||
async def test_multi_level_wildcard_topic_not_matching(hass):
|
||||
async def test_multi_level_wildcard_topic_not_matching(hass: HomeAssistant) -> None:
|
||||
"""Test not matching multi level wildcard topic."""
|
||||
dev_id = "zanzito"
|
||||
entity_id = f"{DT_DOMAIN}.{dev_id}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue