Use new Platform enum in Renault (#60903)
* Use Platform enum in Renault * Use Platform enum in Renault tests Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
231d434b76
commit
75ec937359
7 changed files with 58 additions and 73 deletions
|
@ -4,9 +4,8 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_registry import EntityRegistry
|
||||
|
||||
|
@ -26,7 +25,7 @@ pytestmark = pytest.mark.usefixtures("patch_renault_account", "patch_get_vehicle
|
|||
@pytest.fixture(autouse=True)
|
||||
def override_platforms():
|
||||
"""Override PLATFORMS."""
|
||||
with patch("homeassistant.components.renault.PLATFORMS", [SENSOR_DOMAIN]):
|
||||
with patch("homeassistant.components.renault.PLATFORMS", [Platform.SENSOR]):
|
||||
yield
|
||||
|
||||
|
||||
|
@ -57,7 +56,7 @@ async def test_sensors(
|
|||
mock_vehicle = MOCK_VEHICLES[vehicle_type]
|
||||
check_device_registry(device_registry, mock_vehicle["expected_device"])
|
||||
|
||||
expected_entities = mock_vehicle[SENSOR_DOMAIN]
|
||||
expected_entities = mock_vehicle[Platform.SENSOR]
|
||||
assert len(entity_registry.entities) == len(expected_entities)
|
||||
|
||||
_check_and_enable_disabled_entities(entity_registry, expected_entities)
|
||||
|
@ -81,7 +80,7 @@ async def test_sensor_empty(
|
|||
mock_vehicle = MOCK_VEHICLES[vehicle_type]
|
||||
check_device_registry(device_registry, mock_vehicle["expected_device"])
|
||||
|
||||
expected_entities = mock_vehicle[SENSOR_DOMAIN]
|
||||
expected_entities = mock_vehicle[Platform.SENSOR]
|
||||
assert len(entity_registry.entities) == len(expected_entities)
|
||||
|
||||
_check_and_enable_disabled_entities(entity_registry, expected_entities)
|
||||
|
@ -105,7 +104,7 @@ async def test_sensor_errors(
|
|||
mock_vehicle = MOCK_VEHICLES[vehicle_type]
|
||||
check_device_registry(device_registry, mock_vehicle["expected_device"])
|
||||
|
||||
expected_entities = mock_vehicle[SENSOR_DOMAIN]
|
||||
expected_entities = mock_vehicle[Platform.SENSOR]
|
||||
assert len(entity_registry.entities) == len(expected_entities)
|
||||
|
||||
_check_and_enable_disabled_entities(entity_registry, expected_entities)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue