Use snapshot_platform helper for BMW tests (#118735)

* Use snapshot_platform helper

* Remove comments

---------

Co-authored-by: Richard <rikroe@users.noreply.github.com>
pull/118845/head
Richard Kroegel 2024-06-03 19:46:04 +02:00 committed by Franck Nijhof
parent 4bfff12570
commit c8538f3c08
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
10 changed files with 3486 additions and 966 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,43 @@
# serializer version: 1
# name: test_entity_state_attrs
list([
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'device_class': 'battery',
'friendly_name': 'iX xDrive50 Target SoC',
# name: test_entity_state_attrs[number.i4_edrive40_target_soc-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 100.0,
'min': 20.0,
'mode': <NumberMode.SLIDER: 'slider'>,
'step': 5.0,
}),
'context': <ANY>,
'entity_id': 'number.ix_xdrive50_target_soc',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '80',
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'number',
'entity_category': None,
'entity_id': 'number.i4_edrive40_target_soc',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.BATTERY: 'battery'>,
'original_icon': None,
'original_name': 'Target SoC',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'target_soc',
'unique_id': 'WBA00000000DEMO02-target_soc',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[number.i4_edrive40_target_soc-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
@ -34,6 +54,62 @@
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '80',
}),
])
})
# ---
# name: test_entity_state_attrs[number.ix_xdrive50_target_soc-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max': 100.0,
'min': 20.0,
'mode': <NumberMode.SLIDER: 'slider'>,
'step': 5.0,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'number',
'entity_category': None,
'entity_id': 'number.ix_xdrive50_target_soc',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <NumberDeviceClass.BATTERY: 'battery'>,
'original_icon': None,
'original_name': 'Target SoC',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'target_soc',
'unique_id': 'WBA00000000DEMO01-target_soc',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[number.ix_xdrive50_target_soc-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'device_class': 'battery',
'friendly_name': 'iX xDrive50 Target SoC',
'max': 100.0,
'min': 20.0,
'mode': <NumberMode.SLIDER: 'slider'>,
'step': 5.0,
}),
'context': <ANY>,
'entity_id': 'number.ix_xdrive50_target_soc',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '80',
})
# ---

View File

@ -1,10 +1,66 @@
# serializer version: 1
# name: test_entity_state_attrs
list([
# name: test_entity_state_attrs[select.i3_rex_charging_mode-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.i3_rex_charging_mode',
'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': 'Charging Mode',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'charging_mode',
'unique_id': 'WBY00000000REXI01-charging_mode',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[select.i3_rex_charging_mode-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 AC Charging Limit',
'friendly_name': 'i3 (+ REX) Charging Mode',
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'context': <ANY>,
'entity_id': 'select.i3_rex_charging_mode',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'DELAYED_CHARGING',
})
# ---
# name: test_entity_state_attrs[select.i4_edrive40_ac_charging_limit-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'6',
'7',
@ -20,31 +76,35 @@
'20',
'32',
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.i4_edrive40_ac_charging_limit',
'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': 'AC Charging Limit',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'ac_limit',
'unique_id': 'WBA00000000DEMO02-ac_limit',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
}),
'context': <ANY>,
'entity_id': 'select.ix_xdrive50_ac_charging_limit',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '16',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Charging Mode',
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'context': <ANY>,
'entity_id': 'select.ix_xdrive50_charging_mode',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'IMMEDIATE_CHARGING',
}),
})
# ---
# name: test_entity_state_attrs[select.i4_edrive40_ac_charging_limit-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
@ -72,7 +132,47 @@
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '16',
})
# ---
# name: test_entity_state_attrs[select.i4_edrive40_charging_mode-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.i4_edrive40_charging_mode',
'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': 'Charging Mode',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'charging_mode',
'unique_id': 'WBA00000000DEMO02-charging_mode',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[select.i4_edrive40_charging_mode-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
@ -88,22 +188,140 @@
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'IMMEDIATE_CHARGING',
})
# ---
# name: test_entity_state_attrs[select.ix_xdrive50_ac_charging_limit-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'20',
'32',
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.ix_xdrive50_ac_charging_limit',
'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': 'AC Charging Limit',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'ac_limit',
'unique_id': 'WBA00000000DEMO01-ac_limit',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
})
# ---
# name: test_entity_state_attrs[select.ix_xdrive50_ac_charging_limit-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'i3 (+ REX) Charging Mode',
'friendly_name': 'iX xDrive50 AC Charging Limit',
'options': list([
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'20',
'32',
]),
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
}),
'context': <ANY>,
'entity_id': 'select.ix_xdrive50_ac_charging_limit',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '16',
})
# ---
# name: test_entity_state_attrs[select.ix_xdrive50_charging_mode-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': None,
'entity_id': 'select.ix_xdrive50_charging_mode',
'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': 'Charging Mode',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'charging_mode',
'unique_id': 'WBA00000000DEMO01-charging_mode',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[select.ix_xdrive50_charging_mode-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Charging Mode',
'options': list([
'IMMEDIATE_CHARGING',
'DELAYED_CHARGING',
]),
}),
'context': <ANY>,
'entity_id': 'select.i3_rex_charging_mode',
'entity_id': 'select.ix_xdrive50_charging_mode',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'DELAYED_CHARGING',
}),
])
'state': 'IMMEDIATE_CHARGING',
})
# ---

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,38 @@
# serializer version: 1
# name: test_entity_state_attrs
list([
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Climate',
# name: test_entity_state_attrs[switch.i4_edrive40_climate-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'context': <ANY>,
'entity_id': 'switch.ix_xdrive50_climate',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.i4_edrive40_climate',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Charging',
}),
'context': <ANY>,
'entity_id': 'switch.ix_xdrive50_charging',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Climate',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'climate',
'unique_id': 'WBA00000000DEMO02-climate',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[switch.i4_edrive40_climate-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
@ -36,7 +44,136 @@
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_entity_state_attrs[switch.ix_xdrive50_charging-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.ix_xdrive50_charging',
'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': 'Charging',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'charging',
'unique_id': 'WBA00000000DEMO01-charging',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[switch.ix_xdrive50_charging-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Charging',
}),
'context': <ANY>,
'entity_id': 'switch.ix_xdrive50_charging',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_entity_state_attrs[switch.ix_xdrive50_climate-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.ix_xdrive50_climate',
'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': 'Climate',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'climate',
'unique_id': 'WBA00000000DEMO01-climate',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[switch.ix_xdrive50_climate-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
'friendly_name': 'iX xDrive50 Climate',
}),
'context': <ANY>,
'entity_id': 'switch.ix_xdrive50_climate',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_entity_state_attrs[switch.m340i_xdrive_climate-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.m340i_xdrive_climate',
'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': 'Climate',
'platform': 'bmw_connected_drive',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'climate',
'unique_id': 'WBA00000000DEMO03-climate',
'unit_of_measurement': None,
})
# ---
# name: test_entity_state_attrs[switch.m340i_xdrive_climate-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'attribution': 'Data provided by MyBMW',
@ -48,6 +185,5 @@
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
}),
])
})
# ---

View File

@ -1,6 +1,6 @@
"""Test BMW buttons."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from bimmer_connected.models import MyBMWRemoteServiceError
from bimmer_connected.vehicle.remote_services import RemoteServices
@ -8,25 +8,33 @@ import pytest
import respx
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from . import check_remote_service_call, setup_mocked_integration
from tests.common import snapshot_platform
@pytest.mark.usefixtures("bmw_fixture")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_entity_state_attrs(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Test button options and values."""
# Setup component
assert await setup_mocked_integration(hass)
with patch(
"homeassistant.components.bmw_connected_drive.PLATFORMS",
[Platform.BUTTON],
):
mock_config_entry = await setup_mocked_integration(hass)
# Get all button entities
assert hass.states.async_all("button") == snapshot
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.parametrize(

View File

@ -1,6 +1,6 @@
"""Test BMW numbers."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from bimmer_connected.models import MyBMWAPIError, MyBMWRemoteServiceError
from bimmer_connected.vehicle.remote_services import RemoteServices
@ -8,25 +8,33 @@ import pytest
import respx
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from . import check_remote_service_call, setup_mocked_integration
from tests.common import snapshot_platform
@pytest.mark.usefixtures("bmw_fixture")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_entity_state_attrs(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Test number options and values.."""
"""Test number options and values."""
# Setup component
assert await setup_mocked_integration(hass)
with patch(
"homeassistant.components.bmw_connected_drive.PLATFORMS",
[Platform.NUMBER],
):
mock_config_entry = await setup_mocked_integration(hass)
# Get all number entities
assert hass.states.async_all("number") == snapshot
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.parametrize(

View File

@ -1,6 +1,6 @@
"""Test BMW selects."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from bimmer_connected.models import MyBMWAPIError, MyBMWRemoteServiceError
from bimmer_connected.vehicle.remote_services import RemoteServices
@ -8,25 +8,33 @@ import pytest
import respx
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import entity_registry as er
from . import check_remote_service_call, setup_mocked_integration
from tests.common import snapshot_platform
@pytest.mark.usefixtures("bmw_fixture")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_entity_state_attrs(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Test select options and values.."""
# Setup component
assert await setup_mocked_integration(hass)
with patch(
"homeassistant.components.bmw_connected_drive.PLATFORMS",
[Platform.SELECT],
):
mock_config_entry = await setup_mocked_integration(hass)
# Get all select entities
assert hass.states.async_all("select") == snapshot
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.parametrize(

View File

@ -1,9 +1,13 @@
"""Test BMW sensors."""
from unittest.mock import patch
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util.unit_system import (
METRIC_SYSTEM as METRIC,
US_CUSTOMARY_SYSTEM as IMPERIAL,
@ -12,6 +16,8 @@ from homeassistant.util.unit_system import (
from . import setup_mocked_integration
from tests.common import snapshot_platform
@pytest.mark.freeze_time("2023-06-22 10:30:00+00:00")
@pytest.mark.usefixtures("bmw_fixture")
@ -19,14 +25,17 @@ from . import setup_mocked_integration
async def test_entity_state_attrs(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Test sensor options and values.."""
# Setup component
assert await setup_mocked_integration(hass)
with patch(
"homeassistant.components.bmw_connected_drive.PLATFORMS", [Platform.SENSOR]
):
mock_config_entry = await setup_mocked_integration(hass)
# Get all select entities
assert hass.states.async_all("sensor") == snapshot
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.usefixtures("bmw_fixture")

View File

@ -1,6 +1,6 @@
"""Test BMW switches."""
from unittest.mock import AsyncMock
from unittest.mock import AsyncMock, patch
from bimmer_connected.models import MyBMWAPIError, MyBMWRemoteServiceError
from bimmer_connected.vehicle.remote_services import RemoteServices
@ -8,24 +8,33 @@ import pytest
import respx
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from . import check_remote_service_call, setup_mocked_integration
from tests.common import snapshot_platform
@pytest.mark.usefixtures("bmw_fixture")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_entity_state_attrs(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
) -> None:
"""Test switch options and values.."""
# Setup component
assert await setup_mocked_integration(hass)
with patch(
"homeassistant.components.bmw_connected_drive.PLATFORMS",
[Platform.SWITCH],
):
mock_config_entry = await setup_mocked_integration(hass)
# Get all switch entities
assert hass.states.async_all("switch") == snapshot
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.parametrize(