mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Add test coverage for Tessie seat coolers (#121742)
This commit is contained in:
parent
4c972694cd
commit
f8015a7abc
@ -98,6 +98,8 @@
|
||||
"passenger_temp_setting": 22.5,
|
||||
"remote_heater_control_enabled": false,
|
||||
"right_temp_direction": 234,
|
||||
"seat_fan_front_left": 0,
|
||||
"seat_fan_front_right": 0,
|
||||
"seat_heater_left": 0,
|
||||
"seat_heater_rear_center": 0,
|
||||
"seat_heater_rear_left": 0,
|
||||
@ -157,7 +159,7 @@
|
||||
"exterior_trim_override": "",
|
||||
"has_air_suspension": false,
|
||||
"has_ludicrous_mode": false,
|
||||
"has_seat_cooling": false,
|
||||
"has_seat_cooling": true,
|
||||
"headlamp_type": "Global",
|
||||
"interior_trim_type": "White2",
|
||||
"key_version": 2,
|
||||
|
@ -111,6 +111,8 @@
|
||||
"passenger_temp_setting": 22.5,
|
||||
"remote_heater_control_enabled": false,
|
||||
"right_temp_direction": 234,
|
||||
"seat_fan_front_left": 0,
|
||||
"seat_fan_front_right": 0,
|
||||
"seat_heater_left": 0,
|
||||
"seat_heater_rear_center": 0,
|
||||
"seat_heater_rear_left": 0,
|
||||
@ -174,7 +176,7 @@
|
||||
"exterior_trim_override": "",
|
||||
"has_air_suspension": false,
|
||||
"has_ludicrous_mode": false,
|
||||
"has_seat_cooling": false,
|
||||
"has_seat_cooling": true,
|
||||
"headlamp_type": "Global",
|
||||
"interior_trim_type": "White2",
|
||||
"key_version": 2,
|
||||
|
@ -247,6 +247,8 @@
|
||||
'climate_state_passenger_temp_setting': 22.5,
|
||||
'climate_state_remote_heater_control_enabled': False,
|
||||
'climate_state_right_temp_direction': 234,
|
||||
'climate_state_seat_fan_front_left': 0,
|
||||
'climate_state_seat_fan_front_right': 0,
|
||||
'climate_state_seat_heater_left': 0,
|
||||
'climate_state_seat_heater_rear_center': 0,
|
||||
'climate_state_seat_heater_rear_left': 0,
|
||||
@ -313,7 +315,7 @@
|
||||
'vehicle_config_exterior_trim_override': '',
|
||||
'vehicle_config_has_air_suspension': False,
|
||||
'vehicle_config_has_ludicrous_mode': False,
|
||||
'vehicle_config_has_seat_cooling': False,
|
||||
'vehicle_config_has_seat_cooling': True,
|
||||
'vehicle_config_headlamp_type': 'Global',
|
||||
'vehicle_config_interior_trim_type': 'White2',
|
||||
'vehicle_config_key_version': 2,
|
||||
|
@ -113,6 +113,124 @@
|
||||
'state': 'self_consumption',
|
||||
})
|
||||
# ---
|
||||
# name: test_select[select.test_seat_cooler_left-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
<TessieSeatCoolerOptions.OFF: 'off'>,
|
||||
<TessieSeatCoolerOptions.LOW: 'low'>,
|
||||
<TessieSeatCoolerOptions.MEDIUM: 'medium'>,
|
||||
<TessieSeatCoolerOptions.HIGH: 'high'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': None,
|
||||
'entity_id': 'select.test_seat_cooler_left',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Seat cooler left',
|
||||
'platform': 'tessie',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'climate_state_seat_fan_front_left',
|
||||
'unique_id': 'VINVINVIN-climate_state_seat_fan_front_left',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_select[select.test_seat_cooler_left-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Seat cooler left',
|
||||
'options': list([
|
||||
<TessieSeatCoolerOptions.OFF: 'off'>,
|
||||
<TessieSeatCoolerOptions.LOW: 'low'>,
|
||||
<TessieSeatCoolerOptions.MEDIUM: 'medium'>,
|
||||
<TessieSeatCoolerOptions.HIGH: 'high'>,
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.test_seat_cooler_left',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_select[select.test_seat_cooler_right-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
<TessieSeatCoolerOptions.OFF: 'off'>,
|
||||
<TessieSeatCoolerOptions.LOW: 'low'>,
|
||||
<TessieSeatCoolerOptions.MEDIUM: 'medium'>,
|
||||
<TessieSeatCoolerOptions.HIGH: 'high'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': None,
|
||||
'entity_id': 'select.test_seat_cooler_right',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Seat cooler right',
|
||||
'platform': 'tessie',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'climate_state_seat_fan_front_right',
|
||||
'unique_id': 'VINVINVIN-climate_state_seat_fan_front_right',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_select[select.test_seat_cooler_right-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Seat cooler right',
|
||||
'options': list([
|
||||
<TessieSeatCoolerOptions.OFF: 'off'>,
|
||||
<TessieSeatCoolerOptions.LOW: 'low'>,
|
||||
<TessieSeatCoolerOptions.MEDIUM: 'medium'>,
|
||||
<TessieSeatCoolerOptions.HIGH: 'high'>,
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.test_seat_cooler_right',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_select[select.test_seat_heater_left-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
@ -11,7 +11,10 @@ from homeassistant.components.select import (
|
||||
DOMAIN as SELECT_DOMAIN,
|
||||
SERVICE_SELECT_OPTION,
|
||||
)
|
||||
from homeassistant.components.tessie.const import TessieSeatHeaterOptions
|
||||
from homeassistant.components.tessie.const import (
|
||||
TessieSeatCoolerOptions,
|
||||
TessieSeatHeaterOptions,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_OPTION, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
@ -81,6 +84,22 @@ async def test_select(
|
||||
assert state.state == EnergyExportMode.BATTERY_OK.value
|
||||
call.assert_called_once()
|
||||
|
||||
# Test changing select
|
||||
entity_id = "select.test_seat_cooler_left"
|
||||
with patch(
|
||||
"homeassistant.components.tessie.select.set_seat_cool",
|
||||
return_value=TEST_RESPONSE,
|
||||
) as mock_set:
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
SERVICE_SELECT_OPTION,
|
||||
{ATTR_ENTITY_ID: [entity_id], ATTR_OPTION: TessieSeatCoolerOptions.LOW},
|
||||
blocking=True,
|
||||
)
|
||||
mock_set.assert_called_once()
|
||||
assert mock_set.call_args[1]["seat"] == "front_left"
|
||||
assert mock_set.call_args[1]["level"] == 1
|
||||
|
||||
|
||||
async def test_errors(hass: HomeAssistant) -> None:
|
||||
"""Tests unknown error is handled."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user