1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-07-03 03:45:45 +01:00
Files
supervisor/tests/resolution/fixup/test_app_execute_remove.py
T
Mike Degatano f8880a72be Rename addon/addons to app/apps in filenames and imports (#6837)
* 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>
2026-05-13 20:55:46 +02:00

68 lines
1.9 KiB
Python

"""Test evaluation base."""
from unittest.mock import patch
from supervisor.apps.app import App
from supervisor.coresys import CoreSys
from supervisor.resolution.const import ContextType, IssueType, SuggestionType
from supervisor.resolution.data import Issue, Suggestion
from supervisor.resolution.fixups.app_execute_remove import FixupAppExecuteRemove
async def test_fixup(coresys: CoreSys, install_app_ssh: App):
"""Test fixup."""
app_execute_remove = FixupAppExecuteRemove(coresys)
assert app_execute_remove.auto is False
coresys.resolution.add_suggestion(
Suggestion(
SuggestionType.EXECUTE_REMOVE,
ContextType.ADDON,
reference=install_app_ssh.slug,
)
)
coresys.resolution.add_issue(
Issue(
IssueType.DETACHED_ADDON_REMOVED,
ContextType.ADDON,
reference=install_app_ssh.slug,
)
)
with patch.object(App, "uninstall") as uninstall:
await app_execute_remove()
assert uninstall.called
assert len(coresys.resolution.suggestions) == 0
assert len(coresys.resolution.issues) == 0
async def test_fixup_deprecated_arch_app(coresys: CoreSys, install_app_ssh: App):
"""Test fixup for deprecated arch app issue."""
app_execute_remove = FixupAppExecuteRemove(coresys)
coresys.resolution.add_suggestion(
Suggestion(
SuggestionType.EXECUTE_REMOVE,
ContextType.ADDON,
reference=install_app_ssh.slug,
)
)
coresys.resolution.add_issue(
Issue(
IssueType.DEPRECATED_ARCH_ADDON,
ContextType.ADDON,
reference=install_app_ssh.slug,
)
)
with patch.object(App, "uninstall") as uninstall:
await app_execute_remove()
assert uninstall.called
assert len(coresys.resolution.suggestions) == 0
assert len(coresys.resolution.issues) == 0