mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Move Whirlpool test and clean unused code (#142617)
This commit is contained in:
parent
b3fccc0de6
commit
dd97d5bc7e
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from whirlpool.aircon import Aircon, FanSpeed as AirconFanSpeed, Mode as AirconMode
|
from whirlpool.aircon import Aircon, FanSpeed as AirconFanSpeed, Mode as AirconMode
|
||||||
@ -26,9 +25,6 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
|||||||
from . import WhirlpoolConfigEntry
|
from . import WhirlpoolConfigEntry
|
||||||
from .entity import WhirlpoolEntity
|
from .entity import WhirlpoolEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
AIRCON_MODE_MAP = {
|
AIRCON_MODE_MAP = {
|
||||||
AirconMode.Cool: HVACMode.COOL,
|
AirconMode.Cool: HVACMode.COOL,
|
||||||
AirconMode.Heat: HVACMode.HEAT,
|
AirconMode.Heat: HVACMode.HEAT,
|
||||||
@ -75,7 +71,6 @@ class AirConEntity(WhirlpoolEntity, ClimateEntity):
|
|||||||
"""Representation of an air conditioner."""
|
"""Representation of an air conditioner."""
|
||||||
|
|
||||||
_attr_fan_modes = SUPPORTED_FAN_MODES
|
_attr_fan_modes = SUPPORTED_FAN_MODES
|
||||||
_attr_has_entity_name = True
|
|
||||||
_attr_name = None
|
_attr_name = None
|
||||||
_attr_hvac_modes = SUPPORTED_HVAC_MODES
|
_attr_hvac_modes = SUPPORTED_HVAC_MODES
|
||||||
_attr_max_temp = SUPPORTED_MAX_TEMP
|
_attr_max_temp = SUPPORTED_MAX_TEMP
|
||||||
|
@ -63,16 +63,6 @@ async def update_ac_state(
|
|||||||
return hass.states.get(entity_id)
|
return hass.states.get(entity_id)
|
||||||
|
|
||||||
|
|
||||||
async def test_no_appliances(
|
|
||||||
hass: HomeAssistant, mock_appliances_manager_api: MagicMock
|
|
||||||
) -> None:
|
|
||||||
"""Test the setup of the climate entities when there are no appliances available."""
|
|
||||||
mock_appliances_manager_api.return_value.aircons = []
|
|
||||||
mock_appliances_manager_api.return_value.washer_dryers = []
|
|
||||||
await init_integration(hass)
|
|
||||||
assert len(hass.states.async_all()) == 0
|
|
||||||
|
|
||||||
|
|
||||||
async def test_static_attributes(
|
async def test_static_attributes(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
@ -135,7 +135,7 @@ async def test_form_auth_error(
|
|||||||
|
|
||||||
@pytest.mark.usefixtures("mock_auth_api", "mock_appliances_manager_api")
|
@pytest.mark.usefixtures("mock_auth_api", "mock_appliances_manager_api")
|
||||||
async def test_form_already_configured(hass: HomeAssistant, region, brand) -> None:
|
async def test_form_already_configured(hass: HomeAssistant, region, brand) -> None:
|
||||||
"""Test we handle cannot connect error."""
|
"""Test that configuring the integration twice with the same data fails."""
|
||||||
mock_entry = MockConfigEntry(
|
mock_entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data=CONFIG_INPUT | {"region": region[0], "brand": brand[0]},
|
data=CONFIG_INPUT | {"region": region[0], "brand": brand[0]},
|
||||||
|
@ -75,6 +75,16 @@ async def test_setup_brand_fallback(
|
|||||||
mock_backend_selector_api.assert_called_once_with(Brand.Whirlpool, region[1])
|
mock_backend_selector_api.assert_called_once_with(Brand.Whirlpool, region[1])
|
||||||
|
|
||||||
|
|
||||||
|
async def test_setup_no_appliances(
|
||||||
|
hass: HomeAssistant, mock_appliances_manager_api: MagicMock
|
||||||
|
) -> None:
|
||||||
|
"""Test setup when there are no appliances available."""
|
||||||
|
mock_appliances_manager_api.return_value.aircons = []
|
||||||
|
mock_appliances_manager_api.return_value.washer_dryers = []
|
||||||
|
await init_integration(hass)
|
||||||
|
assert len(hass.states.async_all()) == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_setup_http_exception(
|
async def test_setup_http_exception(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_auth_api: MagicMock,
|
mock_auth_api: MagicMock,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user