Use issue registry fixture (#105633)

pull/105642/head
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"

View File

@ -146,6 +146,7 @@ async def test_create_issue(
hass: HomeAssistant,
mock_write_config,
entity_registry_enabled_by_default: None,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test we create an issue when an automation or script is using a deprecated entity."""
assert await async_setup_component(
@ -186,7 +187,6 @@ async def test_create_issue(
assert automations_with_entity(hass, ENTITY_WATCH_TV)[0] == "automation.test"
assert scripts_with_entity(hass, ENTITY_WATCH_TV)[0] == "script.test"
issue_registry: ir.IssueRegistry = ir.async_get(hass)
assert issue_registry.async_get_issue(DOMAIN, "deprecated_switches")
assert issue_registry.async_get_issue(

View File

@ -503,11 +503,12 @@ async def test_block_restored_climate_auth_error(
async def test_device_not_calibrated(
hass: HomeAssistant, mock_block_device, monkeypatch
hass: HomeAssistant,
mock_block_device,
monkeypatch,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test to create an issue when the device is not calibrated."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
await init_integration(hass, 1, sleep_period=1000, model=MODEL_VALVE)
# Make device online

View File

@ -250,11 +250,12 @@ async def test_block_sleeping_device_no_periodic_updates(
async def test_block_device_push_updates_failure(
hass: HomeAssistant, mock_block_device, monkeypatch
hass: HomeAssistant,
mock_block_device,
monkeypatch,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test block device with push updates failure."""
issue_registry: ir.IssueRegistry = ir.async_get(hass)
await init_integration(hass, 1)
# Updates with COAP_REPLAY type should create an issue