mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add test for firmware update scenario (#103314)
This commit is contained in:
parent
fa6d8d281d
commit
2b3d57859e
@ -333,6 +333,10 @@ class ZWaveNodeFirmwareUpdate(UpdateEntity):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Make sure these variables are set for the elif evaluation
|
||||||
|
state = None
|
||||||
|
latest_version = None
|
||||||
|
|
||||||
# If we have a complete previous state, use that to set the latest version
|
# If we have a complete previous state, use that to set the latest version
|
||||||
if (
|
if (
|
||||||
(state := await self.async_get_last_state())
|
(state := await self.async_get_last_state())
|
||||||
|
@ -694,6 +694,42 @@ async def test_update_entity_partial_restore_data(
|
|||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
|
|
||||||
|
async def test_update_entity_partial_restore_data_2(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
client,
|
||||||
|
climate_radio_thermostat_ct100_plus_different_endpoints,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
) -> None:
|
||||||
|
"""Test second scenario where update entity has partial restore data."""
|
||||||
|
mock_restore_cache_with_extra_data(
|
||||||
|
hass,
|
||||||
|
[
|
||||||
|
(
|
||||||
|
State(
|
||||||
|
UPDATE_ENTITY,
|
||||||
|
STATE_ON,
|
||||||
|
{
|
||||||
|
ATTR_INSTALLED_VERSION: "10.7",
|
||||||
|
ATTR_LATEST_VERSION: "10.8",
|
||||||
|
ATTR_SKIPPED_VERSION: None,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
{"latest_version_firmware": None},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
entry = MockConfigEntry(domain="zwave_js", data={"url": "ws://test.org"})
|
||||||
|
entry.add_to_hass(hass)
|
||||||
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
state = hass.states.get(UPDATE_ENTITY)
|
||||||
|
assert state
|
||||||
|
assert state.state == STATE_UNKNOWN
|
||||||
|
assert state.attributes[ATTR_SKIPPED_VERSION] is None
|
||||||
|
assert state.attributes[ATTR_LATEST_VERSION] is None
|
||||||
|
|
||||||
|
|
||||||
async def test_update_entity_full_restore_data_skipped_version(
|
async def test_update_entity_full_restore_data_skipped_version(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
client,
|
client,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user