mirror of https://github.com/home-assistant/core
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
"""Test Renault diagnostics."""
|
|
|
|
import pytest
|
|
from syrupy import SnapshotAssertion
|
|
|
|
from homeassistant.components.renault import DOMAIN
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers import device_registry as dr
|
|
|
|
from tests.components.diagnostics import (
|
|
get_diagnostics_for_config_entry,
|
|
get_diagnostics_for_device,
|
|
)
|
|
from tests.typing import ClientSessionGenerator
|
|
|
|
pytestmark = pytest.mark.usefixtures("patch_renault_account", "patch_get_vehicles")
|
|
|
|
|
|
@pytest.mark.usefixtures("fixtures_with_data")
|
|
@pytest.mark.parametrize("vehicle_type", ["zoe_40"], indirect=True)
|
|
async def test_entry_diagnostics(
|
|
hass: HomeAssistant,
|
|
config_entry: ConfigEntry,
|
|
hass_client: ClientSessionGenerator,
|
|
snapshot: SnapshotAssertion,
|
|
) -> None:
|
|
"""Test config entry diagnostics."""
|
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
|
await hass.async_block_till_done()
|
|
|
|
assert (
|
|
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
|
== snapshot
|
|
)
|
|
|
|
|
|
@pytest.mark.usefixtures("fixtures_with_data")
|
|
@pytest.mark.parametrize("vehicle_type", ["zoe_40"], indirect=True)
|
|
async def test_device_diagnostics(
|
|
hass: HomeAssistant,
|
|
config_entry: ConfigEntry,
|
|
device_registry: dr.DeviceRegistry,
|
|
hass_client: ClientSessionGenerator,
|
|
snapshot: SnapshotAssertion,
|
|
) -> None:
|
|
"""Test config entry diagnostics."""
|
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
|
await hass.async_block_till_done()
|
|
|
|
device = device_registry.async_get_device(
|
|
identifiers={(DOMAIN, "VF1AAAAA555777999")}
|
|
)
|
|
assert device is not None
|
|
|
|
assert (
|
|
await get_diagnostics_for_device(hass, hass_client, config_entry, device)
|
|
== snapshot
|
|
)
|