Quality improvements for Tessie (#106218)

Quality improvements
This commit is contained in:
Brett Adams 2023-12-22 19:11:18 +10:00 committed by GitHub
parent 72da0a0e1d
commit abc57ea706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 13 additions and 14 deletions

View File

@ -38,7 +38,6 @@ class TessieSwitchEntityDescription(SwitchEntityDescription):
on_func: Callable
off_func: Callable
device_class: SwitchDeviceClass = SwitchDeviceClass.SWITCH
DESCRIPTIONS: tuple[TessieSwitchEntityDescription, ...] = (
@ -94,6 +93,7 @@ async def async_setup_entry(
class TessieSwitchEntity(TessieEntity, SwitchEntity):
"""Base class for Tessie Switch."""
_attr_device_class = SwitchDeviceClass.SWITCH
entity_description: TessieSwitchEntityDescription
def __init__(

View File

@ -42,7 +42,6 @@ class TessieUpdateEntity(TessieEntity, UpdateEntity):
@property
def latest_version(self) -> str | None:
"""Return the latest version."""
# Dont show an update when its not in a state that can be actioned
if self.get("vehicle_state_software_update_status") in (
TessieUpdateStatus.AVAILABLE,
TessieUpdateStatus.SCHEDULED,

View File

@ -10,7 +10,7 @@ OFFON = [STATE_OFF, STATE_ON]
async def test_binary_sensors(hass: HomeAssistant) -> None:
"""Tests that the sensors are correct."""
"""Tests that the binary sensor entities are correct."""
assert len(hass.states.async_all("binary_sensor")) == 0

View File

@ -9,7 +9,7 @@ from .common import patch_description, setup_platform
async def test_buttons(hass: HomeAssistant) -> None:
"""Tests that the buttons are correct."""
"""Tests that the button entities are correct."""
await setup_platform(hass)

View File

@ -58,7 +58,7 @@ async def test_form(hass: HomeAssistant, mock_get_state_of_all_vehicles) -> None
async def test_form_errors(
hass: HomeAssistant, side_effect, error, mock_get_state_of_all_vehicles
) -> None:
"""Test invalid auth is handled."""
"""Test errors are handled."""
result1 = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}

View File

@ -21,7 +21,7 @@ WAIT = timedelta(seconds=TESSIE_SYNC_INTERVAL)
async def test_coordinator_online(hass: HomeAssistant, mock_get_state) -> None:
"""Tests that the coordinator handles online vehciles."""
"""Tests that the coordinator handles online vehicles."""
mock_get_state.return_value = TEST_VEHICLE_STATE_ONLINE
await setup_platform(hass)

View File

@ -11,7 +11,7 @@ STATES = TEST_STATE_OF_ALL_VEHICLES["results"][0]["last_state"]
async def test_device_tracker(hass: HomeAssistant) -> None:
"""Tests that the device trackers are correct."""
"""Tests that the device tracker entities are correct."""
assert len(hass.states.async_all(DEVICE_TRACKER_DOMAIN)) == 0

View File

@ -17,21 +17,21 @@ async def test_load_unload(hass: HomeAssistant) -> None:
async def test_auth_failure(hass: HomeAssistant) -> None:
"""Test init with an authentication failure."""
"""Test init with an authentication error."""
entry = await setup_platform(hass, side_effect=ERROR_AUTH)
assert entry.state is ConfigEntryState.SETUP_ERROR
async def test_unknown_failure(hass: HomeAssistant) -> None:
"""Test init with an authentication failure."""
"""Test init with an client response error."""
entry = await setup_platform(hass, side_effect=ERROR_UNKNOWN)
assert entry.state is ConfigEntryState.SETUP_ERROR
async def test_connection_failure(hass: HomeAssistant) -> None:
"""Test init with a network connection failure."""
"""Test init with a network connection error."""
entry = await setup_platform(hass, side_effect=ERROR_CONNECTION)
assert entry.state is ConfigEntryState.SETUP_RETRY

View File

@ -16,7 +16,7 @@ from .common import ERROR_UNKNOWN, TEST_RESPONSE, setup_platform
async def test_select(hass: HomeAssistant) -> None:
"""Tests that the select entity is correct."""
"""Tests that the select entities are correct."""
assert len(hass.states.async_all(SELECT_DOMAIN)) == 0

View File

@ -7,7 +7,7 @@ from .common import TEST_VEHICLE_STATE_ONLINE, setup_platform
async def test_sensors(hass: HomeAssistant) -> None:
"""Tests that the sensors are correct."""
"""Tests that the sensor entities are correct."""
assert len(hass.states.async_all("sensor")) == 0

View File

@ -14,7 +14,7 @@ from .common import TEST_VEHICLE_STATE_ONLINE, setup_platform
async def test_switches(hass: HomeAssistant) -> None:
"""Tests that the switches are correct."""
"""Tests that the switche entities are correct."""
assert len(hass.states.async_all("switch")) == 0

View File

@ -6,7 +6,7 @@ from .common import setup_platform
async def test_updates(hass: HomeAssistant) -> None:
"""Tests that the updates are correct."""
"""Tests that update entity is correct."""
assert len(hass.states.async_all("update")) == 0