mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-17 22:26:30 +00:00
Check if issue in list, not end of list in test (#3891)
* Check if issue in list, not end of list * Similar fix to other test
This commit is contained in:
parent
bb0d89f8fd
commit
2a6fc512e7
@ -7,7 +7,8 @@ import pytest
|
|||||||
from supervisor.const import CoreState
|
from supervisor.const import CoreState
|
||||||
from supervisor.coresys import CoreSys
|
from supervisor.coresys import CoreSys
|
||||||
from supervisor.exceptions import ResolutionNotFound
|
from supervisor.exceptions import ResolutionNotFound
|
||||||
from supervisor.resolution.const import IssueType
|
from supervisor.resolution.const import ContextType, IssueType
|
||||||
|
from supervisor.resolution.data import Issue
|
||||||
from supervisor.resolution.validate import get_valid_modules
|
from supervisor.resolution.validate import get_valid_modules
|
||||||
|
|
||||||
|
|
||||||
@ -48,29 +49,31 @@ async def test_check_running(coresys: CoreSys):
|
|||||||
|
|
||||||
async def test_if_check_make_issue(coresys: CoreSys):
|
async def test_if_check_make_issue(coresys: CoreSys):
|
||||||
"""Test check for setup."""
|
"""Test check for setup."""
|
||||||
|
free_space = Issue(IssueType.FREE_SPACE, ContextType.SYSTEM)
|
||||||
coresys.core.state = CoreState.RUNNING
|
coresys.core.state = CoreState.RUNNING
|
||||||
coresys.security.content_trust = False
|
coresys.security.content_trust = False
|
||||||
|
|
||||||
with patch("shutil.disk_usage", return_value=(1, 1, 1)):
|
with patch("shutil.disk_usage", return_value=(1, 1, 1)):
|
||||||
await coresys.resolution.check.check_system()
|
await coresys.resolution.check.check_system()
|
||||||
|
|
||||||
assert coresys.resolution.issues[-1].type == IssueType.FREE_SPACE
|
assert free_space in coresys.resolution.issues
|
||||||
|
|
||||||
|
|
||||||
async def test_if_check_cleanup_issue(coresys: CoreSys, mock_full_backup):
|
async def test_if_check_cleanup_issue(coresys: CoreSys):
|
||||||
"""Test check for setup."""
|
"""Test check for setup."""
|
||||||
|
free_space = Issue(IssueType.FREE_SPACE, ContextType.SYSTEM)
|
||||||
coresys.core.state = CoreState.RUNNING
|
coresys.core.state = CoreState.RUNNING
|
||||||
coresys.security.content_trust = False
|
coresys.security.content_trust = False
|
||||||
|
|
||||||
with patch("shutil.disk_usage", return_value=(1, 1, 1)):
|
with patch("shutil.disk_usage", return_value=(1, 1, 1)):
|
||||||
await coresys.resolution.check.check_system()
|
await coresys.resolution.check.check_system()
|
||||||
|
|
||||||
assert coresys.resolution.issues[-1].type == IssueType.FREE_SPACE
|
assert free_space in coresys.resolution.issues
|
||||||
|
|
||||||
with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))):
|
with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0**3))):
|
||||||
await coresys.resolution.check.check_system()
|
await coresys.resolution.check.check_system()
|
||||||
|
|
||||||
assert len(coresys.resolution.issues) == 0
|
assert free_space not in coresys.resolution.issues
|
||||||
|
|
||||||
|
|
||||||
async def test_enable_disable_checks(coresys: CoreSys):
|
async def test_enable_disable_checks(coresys: CoreSys):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user