mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-08 02:19:35 +00:00
Add auto update option (#3769)
* Add update freeze option * Freeze to auto update and plugin condition * Add tests * Add supervisor_version evaluation * OS updates require supervisor up to date * Run version check during startup
This commit is contained in:
22
tests/homeassistant/test_core.py
Normal file
22
tests/homeassistant/test_core.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Test Home Assistant core."""
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.exceptions import HomeAssistantJobError
|
||||
|
||||
|
||||
async def test_update_fails_if_out_of_date(coresys: CoreSys):
|
||||
"""Test update of Home Assistant fails when supervisor or plugin is out of date."""
|
||||
coresys.hardware.disk.get_disk_free_space = lambda x: 5000
|
||||
|
||||
with patch.object(
|
||||
type(coresys.supervisor), "need_update", new=PropertyMock(return_value=True)
|
||||
), pytest.raises(HomeAssistantJobError):
|
||||
await coresys.homeassistant.core.update()
|
||||
|
||||
with patch.object(
|
||||
type(coresys.plugins.audio), "need_update", new=PropertyMock(return_value=True)
|
||||
), pytest.raises(HomeAssistantJobError):
|
||||
await coresys.homeassistant.core.update()
|
||||
Reference in New Issue
Block a user