Update platform back-compat for custom components without UpdateEntityFeature (#106528)
This commit is contained in:
parent
81726808e8
commit
4b6aaf6254
2 changed files with 37 additions and 4 deletions
|
@ -865,3 +865,23 @@ async def test_name(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get(entity4.entity_id)
|
||||
assert state
|
||||
assert expected.items() <= state.attributes.items()
|
||||
|
||||
|
||||
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
|
||||
"""Test deprecated supported features ints."""
|
||||
|
||||
class MockUpdateEntity(UpdateEntity):
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return supported features."""
|
||||
return 1
|
||||
|
||||
entity = MockUpdateEntity()
|
||||
assert entity.supported_features_compat is UpdateEntityFeature(1)
|
||||
assert "MockUpdateEntity" in caplog.text
|
||||
assert "is using deprecated supported features values" in caplog.text
|
||||
assert "Instead it should use" in caplog.text
|
||||
assert "UpdateEntityFeature.INSTALL" in caplog.text
|
||||
caplog.clear()
|
||||
assert entity.supported_features_compat is UpdateEntityFeature(1)
|
||||
assert "is using deprecated supported features values" not in caplog.text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue