mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add async_delete_repair_issue method to CloudClient (#144302)
This commit is contained in:
parent
33da5465bd
commit
f3371bcf39
@ -26,7 +26,11 @@ from homeassistant.core import Context, HassJob, HomeAssistant, callback
|
||||
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.issue_registry import (
|
||||
IssueSeverity,
|
||||
async_create_issue,
|
||||
async_delete_issue,
|
||||
)
|
||||
from homeassistant.util.aiohttp import MockRequest, serialize_response
|
||||
|
||||
from . import alexa_config, google_config
|
||||
@ -409,3 +413,7 @@ class CloudClient(Interface):
|
||||
severity=IssueSeverity(severity),
|
||||
is_fixable=False,
|
||||
)
|
||||
|
||||
async def async_delete_repair_issue(self, identifier: str) -> None:
|
||||
"""Delete a repair issue."""
|
||||
async_delete_issue(hass=self._hass, domain=DOMAIN, issue_id=identifier)
|
||||
|
@ -496,6 +496,39 @@ async def test_async_create_repair_issue_unknown(
|
||||
assert issue is None
|
||||
|
||||
|
||||
async def test_async_delete_repair_issue(
|
||||
cloud: MagicMock,
|
||||
mock_cloud_setup: None,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test delete repair issue."""
|
||||
identifier = "test_identifier"
|
||||
issue_registry.issues[(DOMAIN, identifier)] = ir.IssueEntry(
|
||||
active=True,
|
||||
breaks_in_ha_version=None,
|
||||
created=dt_util.utcnow(),
|
||||
data={},
|
||||
dismissed_version=None,
|
||||
domain=DOMAIN,
|
||||
is_fixable=False,
|
||||
is_persistent=True,
|
||||
issue_domain=None,
|
||||
issue_id=identifier,
|
||||
learn_more_url=None,
|
||||
severity="warning",
|
||||
translation_key="test_translation_key",
|
||||
translation_placeholders=None,
|
||||
)
|
||||
|
||||
issue = issue_registry.async_get_issue(domain=DOMAIN, issue_id=identifier)
|
||||
assert issue is not None
|
||||
|
||||
await cloud.client.async_delete_repair_issue(identifier=identifier)
|
||||
|
||||
issue = issue_registry.async_get_issue(domain=DOMAIN, issue_id=identifier)
|
||||
assert issue is None
|
||||
|
||||
|
||||
async def test_disconnected(hass: HomeAssistant) -> None:
|
||||
"""Test cleanup when disconnected from the cloud."""
|
||||
prefs = MagicMock(
|
||||
|
Loading…
x
Reference in New Issue
Block a user