Use setup_test_component_platform helper for binary_sensor entity component tests instead of hass.components (#114293)

This commit is contained in:
Jan-Philipp Benecke 2024-03-27 14:24:02 +01:00 committed by GitHub
parent c222cfd692
commit 6313571fbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 74 additions and 90 deletions

View file

@ -0,0 +1,19 @@
"""Common test utilities for binary_sensor entity component tests."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from tests.common import MockEntity
class MockBinarySensor(MockEntity, BinarySensorEntity):
"""Mock Binary Sensor class."""
@property
def is_on(self):
"""Return true if the binary sensor is on."""
return self._handle("is_on")
@property
def device_class(self):
"""Return the class of this sensor."""
return self._handle("device_class")