mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Cleanup Tuya climate/cover tests (#149157)
This commit is contained in:
parent
ff9fb6228b
commit
c08aa74496
@ -15,8 +15,8 @@ from tests.common import MockConfigEntry
|
||||
DEVICE_MOCKS = {
|
||||
"cl_am43_corded_motor_zigbee_cover": [
|
||||
# https://github.com/home-assistant/core/issues/71242
|
||||
Platform.SELECT,
|
||||
Platform.COVER,
|
||||
Platform.SELECT,
|
||||
],
|
||||
"clkg_curtain_switch": [
|
||||
# https://github.com/home-assistant/core/issues/136055
|
||||
|
@ -8,6 +8,10 @@ import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from tuya_sharing import CustomerDevice
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
)
|
||||
from homeassistant.components.tuya import ManagerCompat
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@ -69,16 +73,17 @@ async def test_fan_mode_windspeed(
|
||||
mock_device: CustomerDevice,
|
||||
) -> None:
|
||||
"""Test fan mode with windspeed."""
|
||||
entity_id = "climate.air_conditioner"
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
state = hass.states.get("climate.air_conditioner")
|
||||
assert state is not None, "climate.air_conditioner does not exist"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None, f"{entity_id} does not exist"
|
||||
assert state.attributes["fan_mode"] == 1
|
||||
await hass.services.async_call(
|
||||
Platform.CLIMATE,
|
||||
"set_fan_mode",
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{
|
||||
"entity_id": "climate.air_conditioner",
|
||||
"entity_id": entity_id,
|
||||
"fan_mode": 2,
|
||||
},
|
||||
)
|
||||
@ -104,17 +109,18 @@ async def test_fan_mode_no_valid_code(
|
||||
mock_device.status_range.pop("windspeed", None)
|
||||
mock_device.status.pop("windspeed", None)
|
||||
|
||||
entity_id = "climate.air_conditioner"
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
state = hass.states.get("climate.air_conditioner")
|
||||
assert state is not None, "climate.air_conditioner does not exist"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None, f"{entity_id} does not exist"
|
||||
assert state.attributes.get("fan_mode") is None
|
||||
with pytest.raises(ServiceNotSupported):
|
||||
await hass.services.async_call(
|
||||
Platform.CLIMATE,
|
||||
"set_fan_mode",
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{
|
||||
"entity_id": "climate.air_conditioner",
|
||||
"entity_id": entity_id,
|
||||
"fan_mode": 2,
|
||||
},
|
||||
blocking=True,
|
||||
|
@ -83,8 +83,9 @@ async def test_percent_state_on_cover(
|
||||
# 100 is closed and 0 is open for Tuya covers
|
||||
mock_device.status["percent_state"] = 100 - percent_state
|
||||
|
||||
entity_id = "cover.kitchen_blinds_curtain"
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
cover_state = hass.states.get("cover.kitchen_blinds_curtain")
|
||||
assert cover_state is not None, "cover.kitchen_blinds_curtain does not exist"
|
||||
assert cover_state.attributes["current_position"] == percent_state
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None, f"{entity_id} does not exist"
|
||||
assert state.attributes["current_position"] == percent_state
|
||||
|
Loading…
x
Reference in New Issue
Block a user