mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 02:49:43 +00:00
* 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
23 lines
815 B
Python
23 lines
815 B
Python
"""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()
|