mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 20:56:30 +00:00
Fix add-on is not installed anymore (#2656)
* Fix add-on is not installed anymore * Fix and add tests
This commit is contained in:
parent
43449c85bb
commit
33385b46a7
@ -57,7 +57,7 @@ class CheckAddonPwned(CheckBase):
|
|||||||
addon = self.sys_addons.get(reference)
|
addon = self.sys_addons.get(reference)
|
||||||
|
|
||||||
# Uninstalled
|
# Uninstalled
|
||||||
if not addon:
|
if not addon or not addon.is_installed:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Not in use anymore
|
# Not in use anymore
|
||||||
|
@ -14,6 +14,7 @@ class TestAddon:
|
|||||||
slug = "my_test"
|
slug = "my_test"
|
||||||
pwned = set()
|
pwned = set()
|
||||||
state = AddonState.STARTED
|
state = AddonState.STARTED
|
||||||
|
is_installed = True
|
||||||
|
|
||||||
|
|
||||||
async def test_check(coresys: CoreSys):
|
async def test_check(coresys: CoreSys):
|
||||||
@ -78,6 +79,13 @@ async def test_approve(coresys: CoreSys):
|
|||||||
):
|
):
|
||||||
assert not await addon_pwned.approve_check(reference=addon.slug)
|
assert not await addon_pwned.approve_check(reference=addon.slug)
|
||||||
|
|
||||||
|
addon.is_installed = False
|
||||||
|
with patch(
|
||||||
|
"supervisor.resolution.checks.addon_pwned.check_pwned_password",
|
||||||
|
AsyncMock(return_value=True),
|
||||||
|
):
|
||||||
|
assert not await addon_pwned.approve_check(reference=addon.slug)
|
||||||
|
|
||||||
|
|
||||||
async def test_did_run(coresys: CoreSys):
|
async def test_did_run(coresys: CoreSys):
|
||||||
"""Test that the check ran as expected."""
|
"""Test that the check ran as expected."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user