Add issue_domain to repairs (#75839)

pull/75843/head
Paulus Schoutsen 2022-07-27 13:53:51 -07:00 committed by GitHub
parent 4ffd6fc4be
commit b0f877eca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 0 deletions

View File

@ -75,6 +75,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
DOMAIN,
issue_id,
is_fixable=False,
issue_domain=alert.integration,
severity=IssueSeverity.WARNING,
translation_key="alert",
translation_placeholders={

View File

@ -86,6 +86,7 @@ def async_create_issue(
domain: str,
issue_id: str,
*,
issue_domain: str | None = None,
breaks_in_ha_version: str | None = None,
is_fixable: bool,
learn_more_url: str | None = None,
@ -106,6 +107,7 @@ def async_create_issue(
issue_registry.async_get_or_create(
domain,
issue_id,
issue_domain=issue_domain,
breaks_in_ha_version=breaks_in_ha_version,
is_fixable=is_fixable,
learn_more_url=learn_more_url,

View File

@ -30,6 +30,8 @@ class IssueEntry:
domain: str
is_fixable: bool | None
issue_id: str
# Used if an integration creates issues for other integrations (ie alerts)
issue_domain: str | None
learn_more_url: str | None
severity: IssueSeverity | None
translation_key: str | None
@ -58,6 +60,7 @@ class IssueRegistry:
domain: str,
issue_id: str,
*,
issue_domain: str | None = None,
breaks_in_ha_version: str | None = None,
is_fixable: bool,
learn_more_url: str | None = None,
@ -75,6 +78,7 @@ class IssueRegistry:
dismissed_version=None,
domain=domain,
is_fixable=is_fixable,
issue_domain=issue_domain,
issue_id=issue_id,
learn_more_url=learn_more_url,
severity=severity,
@ -93,6 +97,7 @@ class IssueRegistry:
active=True,
breaks_in_ha_version=breaks_in_ha_version,
is_fixable=is_fixable,
issue_domain=issue_domain,
learn_more_url=learn_more_url,
severity=severity,
translation_key=translation_key,
@ -155,6 +160,7 @@ class IssueRegistry:
domain=issue["domain"],
is_fixable=None,
issue_id=issue["issue_id"],
issue_domain=None,
learn_more_url=None,
severity=None,
translation_key=None,

View File

@ -95,6 +95,7 @@ async def test_issues_created(hass, hass_client, hass_ws_client):
"ignored": False,
"is_fixable": False,
"issue_id": "transmogrifier_deprecated",
"issue_domain": None,
"learn_more_url": "https://en.wiktionary.org/wiki/transmogrifier",
"severity": "warning",
"translation_key": "transmogrifier_deprecated",
@ -108,6 +109,7 @@ async def test_issues_created(hass, hass_client, hass_ws_client):
"ignored": False,
"is_fixable": True,
"issue_id": "out_of_blinker_fluid",
"issue_domain": None,
"learn_more_url": "https://www.youtube.com/watch?v=b9rntRxLlbU",
"severity": "critical",
"translation_key": "out_of_blinker_fluid",
@ -121,6 +123,7 @@ async def test_issues_created(hass, hass_client, hass_ws_client):
"ignored": False,
"is_fixable": False,
"issue_id": "unfixable_problem",
"issue_domain": None,
"learn_more_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"severity": "warning",
"translation_key": "unfixable_problem",
@ -180,6 +183,7 @@ async def test_issues_created(hass, hass_client, hass_ws_client):
"ignored": False,
"is_fixable": False,
"issue_id": "transmogrifier_deprecated",
"issue_domain": None,
"learn_more_url": "https://en.wiktionary.org/wiki/transmogrifier",
"severity": "warning",
"translation_key": "transmogrifier_deprecated",
@ -193,6 +197,7 @@ async def test_issues_created(hass, hass_client, hass_ws_client):
"ignored": False,
"is_fixable": False,
"issue_id": "unfixable_problem",
"issue_domain": None,
"learn_more_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"severity": "warning",
"translation_key": "unfixable_problem",

View File

@ -133,6 +133,7 @@ async def test_alerts(
"ignored": False,
"is_fixable": False,
"issue_id": f"{alert}_{integration}",
"issue_domain": integration,
"learn_more_url": None,
"severity": "warning",
"translation_key": "alert",
@ -213,6 +214,7 @@ async def test_bad_alerts(
"ignored": False,
"is_fixable": False,
"issue_id": f"{alert}_{integration}",
"issue_domain": integration,
"learn_more_url": None,
"severity": "warning",
"translation_key": "alert",
@ -374,6 +376,7 @@ async def test_alerts_change(
"ignored": False,
"is_fixable": False,
"issue_id": f"{alert}_{integration}",
"issue_domain": integration,
"learn_more_url": None,
"severity": "warning",
"translation_key": "alert",
@ -413,6 +416,7 @@ async def test_alerts_change(
"ignored": False,
"is_fixable": False,
"issue_id": f"{alert}_{integration}",
"issue_domain": integration,
"learn_more_url": None,
"severity": "warning",
"translation_key": "alert",

View File

@ -85,6 +85,7 @@ async def test_create_update_issue(hass: HomeAssistant, hass_ws_client) -> None:
created="2022-07-19T07:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -97,6 +98,7 @@ async def test_create_update_issue(hass: HomeAssistant, hass_ws_client) -> None:
issues[0]["issue_id"],
breaks_in_ha_version=issues[0]["breaks_in_ha_version"],
is_fixable=issues[0]["is_fixable"],
issue_domain="my_issue_domain",
learn_more_url="blablabla",
severity=issues[0]["severity"],
translation_key=issues[0]["translation_key"],
@ -113,6 +115,7 @@ async def test_create_update_issue(hass: HomeAssistant, hass_ws_client) -> None:
dismissed_version=None,
ignored=False,
learn_more_url="blablabla",
issue_domain="my_issue_domain",
)
@ -206,6 +209,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
created="2022-07-19T07:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -226,6 +230,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
created="2022-07-19T07:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -245,6 +250,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
created="2022-07-19T07:53:05+00:00",
dismissed_version=ha_version,
ignored=True,
issue_domain=None,
)
for issue in issues
]
@ -264,6 +270,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
created="2022-07-19T07:53:05+00:00",
dismissed_version=ha_version,
ignored=True,
issue_domain=None,
)
for issue in issues
]
@ -292,6 +299,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
dismissed_version=ha_version,
ignored=True,
learn_more_url="blablabla",
issue_domain=None,
)
# Unignore the same issue
@ -309,6 +317,7 @@ async def test_ignore_issue(hass: HomeAssistant, hass_ws_client) -> None:
dismissed_version=None,
ignored=False,
learn_more_url="blablabla",
issue_domain=None,
)
for issue in issues
]
@ -359,6 +368,7 @@ async def test_delete_issue(hass: HomeAssistant, hass_ws_client, freezer) -> Non
created="2022-07-19T07:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -378,6 +388,7 @@ async def test_delete_issue(hass: HomeAssistant, hass_ws_client, freezer) -> Non
created="2022-07-19T07:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -428,6 +439,7 @@ async def test_delete_issue(hass: HomeAssistant, hass_ws_client, freezer) -> Non
created="2022-07-19T08:53:05+00:00",
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -501,6 +513,7 @@ async def test_sync_methods(
"ignored": False,
"is_fixable": True,
"issue_id": "sync_issue",
"issue_domain": None,
"learn_more_url": "https://theuselessweb.com",
"severity": "error",
"translation_key": "abc_123",

View File

@ -61,6 +61,7 @@ async def create_issues(hass, ws_client):
created=ANY,
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -154,6 +155,7 @@ async def test_dismiss_issue(hass: HomeAssistant, hass_ws_client) -> None:
created=ANY,
dismissed_version=ha_version,
ignored=True,
issue_domain=None,
)
for issue in issues
]
@ -183,6 +185,7 @@ async def test_dismiss_issue(hass: HomeAssistant, hass_ws_client) -> None:
created=ANY,
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -226,6 +229,7 @@ async def test_fix_non_existing_issue(
created=ANY,
dismissed_version=None,
ignored=False,
issue_domain=None,
)
for issue in issues
]
@ -383,6 +387,7 @@ async def test_list_issues(hass: HomeAssistant, hass_storage, hass_ws_client) ->
"dismissed_version": None,
"domain": "test",
"issue_id": "issue_3_inactive",
"issue_domain": None,
},
]
},
@ -404,6 +409,7 @@ async def test_list_issues(hass: HomeAssistant, hass_storage, hass_ws_client) ->
"domain": "test",
"is_fixable": True,
"issue_id": "issue_1",
"issue_domain": None,
"learn_more_url": "https://theuselessweb.com",
"severity": "error",
"translation_key": "abc_123",
@ -414,6 +420,7 @@ async def test_list_issues(hass: HomeAssistant, hass_storage, hass_ws_client) ->
"domain": "test",
"is_fixable": False,
"issue_id": "issue_2",
"issue_domain": None,
"learn_more_url": "https://theuselessweb.com/abc",
"severity": "other",
"translation_key": "even_worse",