Files
supervisor/tests/homeassistant/test_core.py
Mike Degatano c8f184f24c 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
2022-08-15 12:13:22 -04:00

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()