mirror of
https://github.com/elisspace/core.git
synced 2026-10-01 06:49:55 +00:00
Add FTTH information to SFR Box (#89781)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# serializer version: 1
|
||||
# name: test_binary_sensors
|
||||
# name: test_binary_sensors[adsl]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
@@ -28,7 +28,7 @@
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_binary_sensors.1
|
||||
# name: test_binary_sensors[adsl].1
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@@ -88,7 +88,7 @@
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.sfr_box_dsl_status]
|
||||
# name: test_binary_sensors[adsl][binary_sensor.sfr_box_dsl_status]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'connectivity',
|
||||
@@ -101,7 +101,122 @@
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.sfr_box_wan_status]
|
||||
# name: test_binary_sensors[adsl][binary_sensor.sfr_box_wan_status]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'connectivity',
|
||||
'friendly_name': 'SFR Box WAN status',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.sfr_box_wan_status',
|
||||
'last_changed': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[ftth]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'configuration_url': 'http://192.168.0.1',
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'sfr_box',
|
||||
'e4:5d:51:00:11:22',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'manufacturer': None,
|
||||
'model': 'NB6VAC-FXC-r0',
|
||||
'name': 'SFR Box',
|
||||
'name_by_user': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': 'NB6VAC-MAIN-R4.0.44k',
|
||||
'via_device_id': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_binary_sensors[ftth].1
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.sfr_box_wan_status',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.CONNECTIVITY: 'connectivity'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'WAN status',
|
||||
'platform': 'sfr_box',
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'e4:5d:51:00:11:22_wan_status',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.sfr_box_ftth_status',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.CONNECTIVITY: 'connectivity'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'FTTH status',
|
||||
'platform': 'sfr_box',
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'e4:5d:51:00:11:22_ftth_status',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_binary_sensors[ftth][binary_sensor.sfr_box_ftth_status]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'connectivity',
|
||||
'friendly_name': 'SFR Box FTTH status',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.sfr_box_ftth_status',
|
||||
'last_changed': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[ftth][binary_sensor.sfr_box_wan_status]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'connectivity',
|
||||
|
||||
@@ -3,6 +3,7 @@ from collections.abc import Generator
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from sfrbox_api.models import SystemInfo
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -10,7 +11,9 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("system_get_info", "dsl_get_info", "wan_get_info")
|
||||
pytestmark = pytest.mark.usefixtures(
|
||||
"system_get_info", "dsl_get_info", "ftth_get_info", "wan_get_info"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -20,14 +23,18 @@ def override_platforms() -> Generator[None, None, None]:
|
||||
yield
|
||||
|
||||
|
||||
@pytest.mark.parametrize("net_infra", ["adsl", "ftth"])
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
system_get_info: SystemInfo,
|
||||
net_infra: str,
|
||||
) -> None:
|
||||
"""Test for SFR Box binary sensors."""
|
||||
system_get_info.net_infra = net_infra
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user