mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Cleanup renault test constants (#143924)
* More * tweak * Adjust * docstring --------- Co-authored-by: Josef Zweck <josef@zweck.dev>
This commit is contained in:
parent
4ee3290929
commit
40764b6995
File diff suppressed because it is too large
Load Diff
@ -22,19 +22,10 @@ from homeassistant.components.renault.services import (
|
||||
SERVICE_CHARGE_SET_SCHEDULES,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_IDENTIFIERS,
|
||||
ATTR_MANUFACTURER,
|
||||
ATTR_MODEL,
|
||||
ATTR_MODEL_ID,
|
||||
ATTR_NAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .const import MOCK_VEHICLES
|
||||
|
||||
from tests.common import load_fixture
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("patch_renault_account", "patch_get_vehicles")
|
||||
@ -340,7 +331,7 @@ async def test_service_set_ac_schedule_multi(
|
||||
async def test_service_invalid_device_id(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> None:
|
||||
"""Test that service fails with ValueError if device_id not found in registry."""
|
||||
"""Test that service fails if device_id not found in registry."""
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -357,22 +348,19 @@ async def test_service_invalid_device_id(
|
||||
async def test_service_invalid_device_id2(
|
||||
hass: HomeAssistant, device_registry: dr.DeviceRegistry, config_entry: ConfigEntry
|
||||
) -> None:
|
||||
"""Test that service fails with ValueError if device_id not found in vehicles."""
|
||||
"""Test that service fails if device_id not available in the hub."""
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
extra_vehicle = MOCK_VEHICLES["captur_phev"]["expected_device"]
|
||||
|
||||
# Create a fake second vehicle in the device registry, but
|
||||
# not initialised by the hub.
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
identifiers=extra_vehicle[ATTR_IDENTIFIERS],
|
||||
manufacturer=extra_vehicle[ATTR_MANUFACTURER],
|
||||
name=extra_vehicle[ATTR_NAME],
|
||||
model=extra_vehicle[ATTR_MODEL],
|
||||
model_id=extra_vehicle[ATTR_MODEL_ID],
|
||||
identifiers={(DOMAIN, "VF1AAAAA111222333")},
|
||||
name="REG-NUMBER",
|
||||
)
|
||||
device_id = device_registry.async_get_device(
|
||||
identifiers=extra_vehicle[ATTR_IDENTIFIERS]
|
||||
identifiers={(DOMAIN, "VF1AAAAA111222333")},
|
||||
).id
|
||||
|
||||
data = {ATTR_VEHICLE: device_id}
|
||||
|
Loading…
x
Reference in New Issue
Block a user