Hide inactive repairs issues (#75556)
This commit is contained in:
parent
46551a50ef
commit
c861259749
2 changed files with 23 additions and 2 deletions
|
@ -73,6 +73,7 @@ def ws_list_issues(
|
|||
issues = [
|
||||
dataclasses.asdict(issue, dict_factory=ws_dict)
|
||||
for issue in issue_registry.issues.values()
|
||||
if issue.active
|
||||
]
|
||||
|
||||
connection.send_result(msg["id"], {"issues": issues})
|
||||
|
|
|
@ -9,7 +9,11 @@ import pytest
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.repairs import RepairsFlow, async_create_issue
|
||||
from homeassistant.components.repairs import (
|
||||
RepairsFlow,
|
||||
async_create_issue,
|
||||
issue_registry,
|
||||
)
|
||||
from homeassistant.components.repairs.const import DOMAIN
|
||||
from homeassistant.const import __version__ as ha_version
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -366,8 +370,24 @@ async def test_step_unauth(
|
|||
|
||||
|
||||
@freeze_time("2022-07-19 07:53:05")
|
||||
async def test_list_issues(hass: HomeAssistant, hass_ws_client) -> None:
|
||||
async def test_list_issues(hass: HomeAssistant, hass_storage, hass_ws_client) -> None:
|
||||
"""Test we can list issues."""
|
||||
|
||||
# Add an inactive issue, this should not be exposed in the list
|
||||
hass_storage[issue_registry.STORAGE_KEY] = {
|
||||
"version": issue_registry.STORAGE_VERSION,
|
||||
"data": {
|
||||
"issues": [
|
||||
{
|
||||
"created": "2022-07-19T09:41:13.746514+00:00",
|
||||
"dismissed_version": None,
|
||||
"domain": "test",
|
||||
"issue_id": "issue_3_inactive",
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
|
|
Loading…
Add table
Reference in a new issue