This commit is contained in:
G Johansson
2025-06-16 18:59:48 +00:00
parent 75f0487887
commit 02853a9772

View File

@@ -443,7 +443,7 @@ async def test_vacuum_log_deprecated_battery_properties(
config_flow_fixture: None, config_flow_fixture: None,
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test incorrectly using battery properties logs watning.""" """Test incorrectly using battery properties logs warning."""
class MockLegacyVacuum(MockVacuum): class MockLegacyVacuum(MockVacuum):
"""Mocked vacuum entity.""" """Mocked vacuum entity."""
@@ -492,6 +492,13 @@ async def test_vacuum_log_deprecated_battery_properties(
" please report it to the author of the 'test' custom integration" " please report it to the author of the 'test' custom integration"
in caplog.text in caplog.text
) )
assert (
"Detected that custom integration 'test' is setting the battery_level which has been deprecated."
" Integration test should implement a sensor instead with a correct device class and link it"
" to the same device. This will stop working in Home Assistant 2026.7,"
" please report it to the author of the 'test' custom integration"
in caplog.text
)
@pytest.mark.usefixtures("mock_as_custom_component") @pytest.mark.usefixtures("mock_as_custom_component")
@@ -531,6 +538,7 @@ async def test_vacuum_log_deprecated_battery_properties_using_attr(
state = hass.states.get(entity.entity_id) state = hass.states.get(entity.entity_id)
assert state is not None assert state is not None
entity.start()
assert ( assert (
"Detected that custom integration 'test' is setting the battery_level which has been deprecated." "Detected that custom integration 'test' is setting the battery_level which has been deprecated."
@@ -539,6 +547,13 @@ async def test_vacuum_log_deprecated_battery_properties_using_attr(
" please report it to the author of the 'test' custom integration" " please report it to the author of the 'test' custom integration"
in caplog.text in caplog.text
) )
assert (
"Detected that custom integration 'test' is setting the battery_icon which has been deprecated."
" Integration test should implement a sensor instead with a correct device class and link it to"
" the same device. This will stop working in Home Assistant 2026.7,"
" please report it to the author of the 'test' custom integration"
in caplog.text
)
await async_start(hass, entity.entity_id) await async_start(hass, entity.entity_id)
@@ -552,3 +567,10 @@ async def test_vacuum_log_deprecated_battery_properties_using_attr(
" please report it to the author of the 'test' custom integration" " please report it to the author of the 'test' custom integration"
not in caplog.text not in caplog.text
) )
assert (
"Detected that custom integration 'test' is setting the battery_icon which has been deprecated."
" Integration test should implement a sensor instead with a correct device class and link it to"
" the same device. This will stop working in Home Assistant 2026.7,"
" please report it to the author of the 'test' custom integration"
not in caplog.text
)