Files
supervisor/tests/resolution/fixup/test_app_execute_remove.py
T
c01efa05a5 Rename resolution addon issue types and check slugs to app-based naming (#7098)
* Rename resolution addon issue types and check slugs to app-based naming

Renames the following for consistency with the new apps terminology:
- Issue types: deprecated_addon -> deprecated_app,
  deprecated_arch_addon -> deprecated_arch_app,
  detached_addon_missing -> detached_app_missing,
  detached_addon_removed -> detached_app_removed
- Check slugs: addon_pwned -> app_pwned,
  deprecated_addon -> deprecated_app,
  deprecated_arch_addon -> deprecated_arch_app,
  detached_addon_missing -> detached_app_missing,
  detached_addon_removed -> detached_app_removed

Full backward compatibility is maintained:
- REST API V1 (root) returns legacy names and accepts legacy slugs
- REST API V2 (/v2) returns and accepts new names only
- WebSocket events use legacy names unless SUPERVISOR_WEBSOCKET_V2_API
  feature flag is enabled
- resolution.json files with legacy check slugs are automatically
  migrated to new names on load

Fixes #7029

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Address review nits for resolution compatibility maps

* Update supervisor/resolution/const.py

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Stefan Agner <stefan@agner.ch>
2026-08-04 10:57:42 +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_APP_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_APP,
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