1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Change HomeAssistantType to HomeAssistant (#49522)

This commit is contained in:
jan iversen
2021-04-22 03:53:06 +02:00
committed by GitHub
parent 69c1721c2a
commit 6a4f414236
26 changed files with 197 additions and 221 deletions

View File

@@ -36,7 +36,7 @@ from homeassistant.const import (
ATTR_FRIENDLY_NAME,
ATTR_TEMPERATURE,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@@ -47,13 +47,13 @@ from tests.common import async_fire_time_changed
ENTITY_ID = f"{DOMAIN}.fake_name"
async def setup_fritzbox(hass: HomeAssistantType, config: dict):
async def setup_fritzbox(hass: HomeAssistant, config: dict):
"""Set up mock AVM Fritz!Box."""
assert await async_setup_component(hass, FB_DOMAIN, config) is True
await hass.async_block_till_done()
async def test_setup(hass: HomeAssistantType, fritz: Mock):
async def test_setup(hass: HomeAssistant, fritz: Mock):
"""Test setup of platform."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -80,7 +80,7 @@ async def test_setup(hass: HomeAssistantType, fritz: Mock):
assert state.state == HVAC_MODE_HEAT
async def test_target_temperature_on(hass: HomeAssistantType, fritz: Mock):
async def test_target_temperature_on(hass: HomeAssistant, fritz: Mock):
"""Test turn device on."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -92,7 +92,7 @@ async def test_target_temperature_on(hass: HomeAssistantType, fritz: Mock):
assert state.attributes[ATTR_TEMPERATURE] == 30
async def test_target_temperature_off(hass: HomeAssistantType, fritz: Mock):
async def test_target_temperature_off(hass: HomeAssistant, fritz: Mock):
"""Test turn device on."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -104,7 +104,7 @@ async def test_target_temperature_off(hass: HomeAssistantType, fritz: Mock):
assert state.attributes[ATTR_TEMPERATURE] == 0
async def test_update(hass: HomeAssistantType, fritz: Mock):
async def test_update(hass: HomeAssistant, fritz: Mock):
"""Test update with error."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -132,7 +132,7 @@ async def test_update(hass: HomeAssistantType, fritz: Mock):
assert state.attributes[ATTR_TEMPERATURE] == 20
async def test_update_error(hass: HomeAssistantType, fritz: Mock):
async def test_update_error(hass: HomeAssistant, fritz: Mock):
"""Test update with error."""
device = FritzDeviceClimateMock()
device.update.side_effect = HTTPError("Boom")
@@ -150,7 +150,7 @@ async def test_update_error(hass: HomeAssistantType, fritz: Mock):
assert fritz().login.call_count == 2
async def test_set_temperature_temperature(hass: HomeAssistantType, fritz: Mock):
async def test_set_temperature_temperature(hass: HomeAssistant, fritz: Mock):
"""Test setting temperature by temperature."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -166,7 +166,7 @@ async def test_set_temperature_temperature(hass: HomeAssistantType, fritz: Mock)
assert device.set_target_temperature.call_args_list == [call(123)]
async def test_set_temperature_mode_off(hass: HomeAssistantType, fritz: Mock):
async def test_set_temperature_mode_off(hass: HomeAssistant, fritz: Mock):
"""Test setting temperature by mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -186,7 +186,7 @@ async def test_set_temperature_mode_off(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(0)]
async def test_set_temperature_mode_heat(hass: HomeAssistantType, fritz: Mock):
async def test_set_temperature_mode_heat(hass: HomeAssistant, fritz: Mock):
"""Test setting temperature by mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -206,7 +206,7 @@ async def test_set_temperature_mode_heat(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(22)]
async def test_set_hvac_mode_off(hass: HomeAssistantType, fritz: Mock):
async def test_set_hvac_mode_off(hass: HomeAssistant, fritz: Mock):
"""Test setting hvac mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -222,7 +222,7 @@ async def test_set_hvac_mode_off(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(0)]
async def test_set_hvac_mode_heat(hass: HomeAssistantType, fritz: Mock):
async def test_set_hvac_mode_heat(hass: HomeAssistant, fritz: Mock):
"""Test setting hvac mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -238,7 +238,7 @@ async def test_set_hvac_mode_heat(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(22)]
async def test_set_preset_mode_comfort(hass: HomeAssistantType, fritz: Mock):
async def test_set_preset_mode_comfort(hass: HomeAssistant, fritz: Mock):
"""Test setting preset mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -254,7 +254,7 @@ async def test_set_preset_mode_comfort(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(22)]
async def test_set_preset_mode_eco(hass: HomeAssistantType, fritz: Mock):
async def test_set_preset_mode_eco(hass: HomeAssistant, fritz: Mock):
"""Test setting preset mode."""
device = FritzDeviceClimateMock()
fritz().get_devices.return_value = [device]
@@ -270,7 +270,7 @@ async def test_set_preset_mode_eco(hass: HomeAssistantType, fritz: Mock):
assert device.set_target_temperature.call_args_list == [call(16)]
async def test_preset_mode_update(hass: HomeAssistantType, fritz: Mock):
async def test_preset_mode_update(hass: HomeAssistant, fritz: Mock):
"""Test preset mode."""
device = FritzDeviceClimateMock()
device.comfort_temperature = 98