mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-07-07 22:05:06 +01:00
f8880a72be
* Rename addon/addons to app/apps in filenames and imports Continues the addon→app terminology migration (#6786). Renames all source files, test files, fixture files, and directories that contained 'addon'/'addons' in their names, and updates all imports accordingly. Resolution check files in supervisor/resolution/checks/ that were renamed override the slug property to preserve the existing API contract (slugs are exposed via the resolution info API and used to run checks by name). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename add-on.json fixture --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
57 lines
2.0 KiB
Python
57 lines
2.0 KiB
Python
"""Test fixup system execute rebuild."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from supervisor.coresys import CoreSys
|
|
from supervisor.resolution.const import ContextType, IssueType, SuggestionType
|
|
from supervisor.resolution.fixups.app_execute_rebuild import FixupAppExecuteRebuild
|
|
from supervisor.resolution.fixups.core_execute_rebuild import FixupCoreExecuteRebuild
|
|
from supervisor.resolution.fixups.plugin_execute_rebuild import (
|
|
FixupPluginExecuteRebuild,
|
|
)
|
|
from supervisor.resolution.fixups.system_execute_rebuild import (
|
|
FixupSystemExecuteRebuild,
|
|
)
|
|
|
|
|
|
async def test_fixup(coresys: CoreSys):
|
|
"""Test fixup applies other rebuild fixups for docker config issues."""
|
|
system_execute_rebuild = FixupSystemExecuteRebuild(coresys)
|
|
|
|
assert system_execute_rebuild.auto is False
|
|
|
|
coresys.resolution.create_issue(
|
|
IssueType.DOCKER_CONFIG,
|
|
ContextType.ADDON,
|
|
reference="local_ssh",
|
|
suggestions=[SuggestionType.EXECUTE_REBUILD],
|
|
)
|
|
coresys.resolution.create_issue(
|
|
IssueType.DOCKER_CONFIG,
|
|
ContextType.CORE,
|
|
suggestions=[SuggestionType.EXECUTE_REBUILD],
|
|
)
|
|
coresys.resolution.create_issue(
|
|
IssueType.DOCKER_CONFIG,
|
|
ContextType.PLUGIN,
|
|
reference="audio",
|
|
suggestions=[SuggestionType.EXECUTE_REBUILD],
|
|
)
|
|
coresys.resolution.create_issue(
|
|
IssueType.DOCKER_CONFIG,
|
|
ContextType.SYSTEM,
|
|
suggestions=[SuggestionType.EXECUTE_REBUILD],
|
|
)
|
|
with (
|
|
patch.object(FixupAppExecuteRebuild, "process_fixup") as app_fixup,
|
|
patch.object(FixupCoreExecuteRebuild, "process_fixup") as core_fixup,
|
|
patch.object(FixupPluginExecuteRebuild, "process_fixup") as plugin_fixup,
|
|
):
|
|
await system_execute_rebuild()
|
|
app_fixup.assert_called_once_with(reference="local_ssh")
|
|
core_fixup.assert_called_once()
|
|
plugin_fixup.assert_called_once_with(reference="audio")
|
|
|
|
assert not coresys.resolution.issues
|
|
assert not coresys.resolution.suggestions
|