mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
It seems that the codebase is not formatted with the latest ruff version. This PR reformats the codebase with ruff 0.5.7.
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Test evaluation base."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from supervisor.addons.addon import Addon
|
|
from supervisor.coresys import CoreSys
|
|
from supervisor.resolution.const import ContextType, IssueType, SuggestionType
|
|
from supervisor.resolution.data import Issue, Suggestion
|
|
from supervisor.resolution.fixups.addon_execute_remove import FixupAddonExecuteRemove
|
|
|
|
|
|
async def test_fixup(coresys: CoreSys, install_addon_ssh: Addon):
|
|
"""Test fixup."""
|
|
addon_execute_remove = FixupAddonExecuteRemove(coresys)
|
|
|
|
assert addon_execute_remove.auto is False
|
|
|
|
coresys.resolution.suggestions = Suggestion(
|
|
SuggestionType.EXECUTE_REMOVE,
|
|
ContextType.ADDON,
|
|
reference=install_addon_ssh.slug,
|
|
)
|
|
coresys.resolution.issues = Issue(
|
|
IssueType.DETACHED_ADDON_REMOVED,
|
|
ContextType.ADDON,
|
|
reference=install_addon_ssh.slug,
|
|
)
|
|
|
|
with patch.object(Addon, "uninstall") as uninstall:
|
|
await addon_execute_remove()
|
|
|
|
assert uninstall.called
|
|
|
|
assert len(coresys.resolution.suggestions) == 0
|
|
assert len(coresys.resolution.issues) == 0
|