Use issue registry fixture (#105633)

This commit is contained in:
Joost Lekkerkerker 2023-12-13 11:23:38 +01:00 committed by GitHub
parent 06f81251fb
commit 22b2c588eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View file

@ -21,10 +21,9 @@ from tests.typing import ClientSessionGenerator
async def test_do_not_create_repair_issues_at_startup_if_not_logged_in(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test that we create repair issue at startup if we are logged in."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
with patch("homeassistant.components.cloud.Cloud.is_logged_in", False):
await mock_cloud(hass)
@ -40,9 +39,9 @@ async def test_create_repair_issues_at_startup_if_logged_in(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
mock_auth: Generator[None, AsyncMock, None],
issue_registry: ir.IssueRegistry,
):
"""Test that we create repair issue at startup if we are logged in."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
aioclient_mock.get(
"https://accounts.nabucasa.com/payments/subscription_info",
json={"provider": "legacy"},
@ -61,9 +60,9 @@ async def test_create_repair_issues_at_startup_if_logged_in(
async def test_legacy_subscription_delete_issue_if_no_longer_legacy(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test that we delete the legacy subscription issue if no longer legacy."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
cloud_repairs.async_manage_legacy_subscription_issue(hass, {"provider": "legacy"})
assert issue_registry.async_get_issue(
domain="cloud", issue_id="legacy_subscription"
@ -80,9 +79,9 @@ async def test_legacy_subscription_repair_flow(
aioclient_mock: AiohttpClientMocker,
mock_auth: Generator[None, AsyncMock, None],
hass_client: ClientSessionGenerator,
issue_registry: ir.IssueRegistry,
):
"""Test desired flow of the fix flow for legacy subscription."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
aioclient_mock.get(
"https://accounts.nabucasa.com/payments/subscription_info",
json={"provider": None},
@ -167,6 +166,7 @@ async def test_legacy_subscription_repair_flow_timeout(
hass_client: ClientSessionGenerator,
mock_auth: Generator[None, AsyncMock, None],
aioclient_mock: AiohttpClientMocker,
issue_registry: ir.IssueRegistry,
):
"""Test timeout flow of the fix flow for legacy subscription."""
aioclient_mock.post(
@ -174,8 +174,6 @@ async def test_legacy_subscription_repair_flow_timeout(
status=403,
)
issue_registry: ir.IssueRegistry = ir.async_get(hass)
cloud_repairs.async_manage_legacy_subscription_issue(hass, {"provider": "legacy"})
repair_issue = issue_registry.async_get_issue(
domain="cloud", issue_id="legacy_subscription"