mirror of
https://github.com/home-assistant/core.git
synced 2025-11-11 20:10:12 +00:00
Add release_url property of Shelly update entities (#103739)
This commit is contained in:
@@ -5,11 +5,16 @@ from aioshelly.exceptions import DeviceConnectionError, InvalidAuthError, RpcCal
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.shelly.const import DOMAIN
|
||||
from homeassistant.components.shelly.const import (
|
||||
DOMAIN,
|
||||
GEN1_RELEASE_URL,
|
||||
GEN2_RELEASE_URL,
|
||||
)
|
||||
from homeassistant.components.update import (
|
||||
ATTR_IN_PROGRESS,
|
||||
ATTR_INSTALLED_VERSION,
|
||||
ATTR_LATEST_VERSION,
|
||||
ATTR_RELEASE_URL,
|
||||
DOMAIN as UPDATE_DOMAIN,
|
||||
SERVICE_INSTALL,
|
||||
UpdateEntityFeature,
|
||||
@@ -75,6 +80,7 @@ async def test_block_update(
|
||||
assert state.attributes[ATTR_INSTALLED_VERSION] == "1"
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "2"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is True
|
||||
assert state.attributes[ATTR_RELEASE_URL] == GEN1_RELEASE_URL
|
||||
|
||||
monkeypatch.setitem(mock_block_device.status["update"], "old_version", "2")
|
||||
await mock_rest_update(hass, freezer)
|
||||
@@ -117,6 +123,7 @@ async def test_block_beta_update(
|
||||
assert state.attributes[ATTR_INSTALLED_VERSION] == "1"
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "2b"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is False
|
||||
assert state.attributes[ATTR_RELEASE_URL] is None
|
||||
|
||||
await hass.services.async_call(
|
||||
UPDATE_DOMAIN,
|
||||
@@ -270,6 +277,7 @@ async def test_rpc_update(hass: HomeAssistant, mock_rpc_device, monkeypatch) ->
|
||||
assert state.attributes[ATTR_INSTALLED_VERSION] == "1"
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "2"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] == 0
|
||||
assert state.attributes[ATTR_RELEASE_URL] == GEN2_RELEASE_URL
|
||||
|
||||
inject_rpc_device_event(
|
||||
monkeypatch,
|
||||
@@ -341,6 +349,7 @@ async def test_rpc_sleeping_update(
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "2"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is False
|
||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == UpdateEntityFeature(0)
|
||||
assert state.attributes[ATTR_RELEASE_URL] == GEN2_RELEASE_URL
|
||||
|
||||
monkeypatch.setitem(mock_rpc_device.shelly, "ver", "2")
|
||||
mock_rpc_device.mock_update()
|
||||
@@ -467,6 +476,7 @@ async def test_rpc_beta_update(
|
||||
assert state.attributes[ATTR_INSTALLED_VERSION] == "1"
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "1"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is False
|
||||
assert state.attributes[ATTR_RELEASE_URL] is None
|
||||
|
||||
monkeypatch.setitem(
|
||||
mock_rpc_device.status["sys"],
|
||||
|
||||
Reference in New Issue
Block a user