Supervisor update entity auto update from api (#79611)
* Supervisor update entity auto update from api * Update api mocks in testspull/79659/head
parent
ed7c93240c
commit
895facdf72
|
@ -219,7 +219,6 @@ class SupervisorOSUpdateEntity(HassioOSEntity, UpdateEntity):
|
|||
class SupervisorSupervisorUpdateEntity(HassioSupervisorEntity, UpdateEntity):
|
||||
"""Update entity to handle updates for the Home Assistant Supervisor."""
|
||||
|
||||
_attr_auto_update = True
|
||||
_attr_supported_features = UpdateEntityFeature.INSTALL
|
||||
_attr_title = "Home Assistant Supervisor"
|
||||
|
||||
|
@ -233,6 +232,11 @@ class SupervisorSupervisorUpdateEntity(HassioSupervisorEntity, UpdateEntity):
|
|||
"""Return native value of entity."""
|
||||
return self.coordinator.data[DATA_KEY_SUPERVISOR][ATTR_VERSION]
|
||||
|
||||
@property
|
||||
def auto_update(self) -> bool:
|
||||
"""Return true if auto-update is enabled for supervisor."""
|
||||
return self.coordinator.data[DATA_KEY_SUPERVISOR][ATTR_AUTO_UPDATE]
|
||||
|
||||
@property
|
||||
def release_url(self) -> str | None:
|
||||
"""URL to the full release notes of the latest version available."""
|
||||
|
|
|
@ -75,6 +75,7 @@ def mock_all(aioclient_mock, request):
|
|||
"result": "ok",
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.0",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test",
|
||||
|
|
|
@ -92,7 +92,11 @@ def mock_all(aioclient_mock, request, os_info):
|
|||
"http://127.0.0.1/supervisor/info",
|
||||
json={
|
||||
"result": "ok",
|
||||
"data": {"version_latest": "1.0.0", "version": "1.0.0"},
|
||||
"data": {
|
||||
"version_latest": "1.0.0",
|
||||
"version": "1.0.0",
|
||||
"auto_update": True,
|
||||
},
|
||||
"addons": [
|
||||
{
|
||||
"name": "test",
|
||||
|
@ -536,6 +540,7 @@ async def test_device_registry_calls(hass):
|
|||
supervisor_mock_data = {
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.0",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test",
|
||||
|
@ -586,6 +591,7 @@ async def test_device_registry_calls(hass):
|
|||
supervisor_mock_data = {
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.0",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test2",
|
||||
|
@ -620,6 +626,7 @@ async def test_device_registry_calls(hass):
|
|||
supervisor_mock_data = {
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.0",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test2",
|
||||
|
|
|
@ -68,6 +68,7 @@ def mock_all(aioclient_mock, request):
|
|||
"result": "ok",
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.0",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test",
|
||||
|
|
|
@ -79,6 +79,7 @@ def mock_all(aioclient_mock, request):
|
|||
"result": "ok",
|
||||
"version": "1.0.0",
|
||||
"version_latest": "1.0.1dev222",
|
||||
"auto_update": True,
|
||||
"addons": [
|
||||
{
|
||||
"name": "test",
|
||||
|
|
Loading…
Reference in New Issue