mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-05-08 08:58:31 +01:00
Extend resolution center (#2297)
* Extend resolution center Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * move forward Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Rename it to fixups Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Finish p1 Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Finish p1 - add files Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Finishup * Add more tests * Add test for suggestion * Add more tests * fix tests & isort * address comments * address comments v2 * fix isort * Change reference handling
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""Test check."""
|
||||
# pylint: disable=import-error
|
||||
from unittest.mock import patch
|
||||
|
||||
from supervisor.const import CoreState
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.resolution.const import IssueType
|
||||
|
||||
|
||||
async def test_check_setup(coresys: CoreSys):
|
||||
"""Test check for setup."""
|
||||
coresys.core.state = CoreState.SETUP
|
||||
with patch(
|
||||
"supervisor.resolution.checks.free_space.CheckFreeSpace.run_check",
|
||||
return_value=False,
|
||||
) as free_space:
|
||||
await coresys.resolution.check.check_system()
|
||||
free_space.assert_not_called()
|
||||
|
||||
|
||||
async def test_check_running(coresys: CoreSys):
|
||||
"""Test check for setup."""
|
||||
coresys.core.state = CoreState.RUNNING
|
||||
with patch(
|
||||
"supervisor.resolution.checks.free_space.CheckFreeSpace.run_check",
|
||||
return_value=False,
|
||||
) as free_space:
|
||||
await coresys.resolution.check.check_system()
|
||||
free_space.assert_called_once()
|
||||
|
||||
|
||||
async def test_if_check_make_issue(coresys: CoreSys):
|
||||
"""Test check for setup."""
|
||||
coresys.core.state = CoreState.RUNNING
|
||||
|
||||
with patch("shutil.disk_usage", return_value=(1, 1, 1)):
|
||||
await coresys.resolution.check.check_system()
|
||||
|
||||
assert coresys.resolution.issues[-1].type == IssueType.FREE_SPACE
|
||||
Reference in New Issue
Block a user