-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Velbus binary sensor tests (#134132)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
- Loading branch information
Showing
4 changed files
with
119 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
"""Tests for the Velbus component.""" | ||
|
||
from homeassistant.components.velbus import VelbusConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
|
||
|
||
async def init_integration( | ||
hass: HomeAssistant, | ||
config_entry: VelbusConfigEntry, | ||
) -> None: | ||
"""Load the Velbus integration.""" | ||
assert await hass.config_entries.async_setup(config_entry.entry_id) | ||
await hass.async_block_till_done() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# serializer version: 1 | ||
# name: test_entities[binary_sensor.buttonon-entry] | ||
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': None, | ||
'entity_id': 'binary_sensor.buttonon', | ||
'has_entity_name': False, | ||
'hidden_by': None, | ||
'icon': None, | ||
'id': <ANY>, | ||
'labels': set({ | ||
}), | ||
'name': None, | ||
'options': dict({ | ||
}), | ||
'original_device_class': None, | ||
'original_icon': None, | ||
'original_name': 'ButtonOn', | ||
'platform': 'velbus', | ||
'previous_unique_id': None, | ||
'supported_features': 0, | ||
'translation_key': None, | ||
'unique_id': 'a1b2c3d4e5f6-1', | ||
'unit_of_measurement': None, | ||
}) | ||
# --- | ||
# name: test_entities[binary_sensor.buttonon-state] | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'friendly_name': 'ButtonOn', | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'binary_sensor.buttonon', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': 'on', | ||
}) | ||
# --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Velbus binary_sensor platform tests.""" | ||
|
||
from unittest.mock import patch | ||
|
||
from syrupy.assertion import SnapshotAssertion | ||
|
||
from homeassistant.const import Platform | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import entity_registry as er | ||
|
||
from . import init_integration | ||
|
||
from tests.common import MockConfigEntry, snapshot_platform | ||
|
||
|
||
async def test_entities( | ||
hass: HomeAssistant, | ||
snapshot: SnapshotAssertion, | ||
config_entry: MockConfigEntry, | ||
entity_registry: er.EntityRegistry, | ||
) -> None: | ||
"""Test all entities.""" | ||
with patch("homeassistant.components.velbus.PLATFORMS", [Platform.BINARY_SENSOR]): | ||
await init_integration(hass, config_entry) | ||
|
||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) |