Use issue registry fixture (#105633)
This commit is contained in:
parent
06f81251fb
commit
22b2c588eb
4 changed files with 14 additions and 14 deletions
|
@ -21,10 +21,9 @@ from tests.typing import ClientSessionGenerator
|
||||||
|
|
||||||
async def test_do_not_create_repair_issues_at_startup_if_not_logged_in(
|
async def test_do_not_create_repair_issues_at_startup_if_not_logged_in(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we create repair issue at startup if we are logged in."""
|
"""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):
|
with patch("homeassistant.components.cloud.Cloud.is_logged_in", False):
|
||||||
await mock_cloud(hass)
|
await mock_cloud(hass)
|
||||||
|
|
||||||
|
@ -40,9 +39,9 @@ async def test_create_repair_issues_at_startup_if_logged_in(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
mock_auth: Generator[None, AsyncMock, None],
|
mock_auth: Generator[None, AsyncMock, None],
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
):
|
):
|
||||||
"""Test that we create repair issue at startup if we are logged in."""
|
"""Test that we create repair issue at startup if we are logged in."""
|
||||||
issue_registry: ir.IssueRegistry = ir.async_get(hass)
|
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
"https://accounts.nabucasa.com/payments/subscription_info",
|
"https://accounts.nabucasa.com/payments/subscription_info",
|
||||||
json={"provider": "legacy"},
|
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(
|
async def test_legacy_subscription_delete_issue_if_no_longer_legacy(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we delete the legacy subscription issue if no longer legacy."""
|
"""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"})
|
cloud_repairs.async_manage_legacy_subscription_issue(hass, {"provider": "legacy"})
|
||||||
assert issue_registry.async_get_issue(
|
assert issue_registry.async_get_issue(
|
||||||
domain="cloud", issue_id="legacy_subscription"
|
domain="cloud", issue_id="legacy_subscription"
|
||||||
|
@ -80,9 +79,9 @@ async def test_legacy_subscription_repair_flow(
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
mock_auth: Generator[None, AsyncMock, None],
|
mock_auth: Generator[None, AsyncMock, None],
|
||||||
hass_client: ClientSessionGenerator,
|
hass_client: ClientSessionGenerator,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
):
|
):
|
||||||
"""Test desired flow of the fix flow for legacy subscription."""
|
"""Test desired flow of the fix flow for legacy subscription."""
|
||||||
issue_registry: ir.IssueRegistry = ir.async_get(hass)
|
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
"https://accounts.nabucasa.com/payments/subscription_info",
|
"https://accounts.nabucasa.com/payments/subscription_info",
|
||||||
json={"provider": None},
|
json={"provider": None},
|
||||||
|
@ -167,6 +166,7 @@ async def test_legacy_subscription_repair_flow_timeout(
|
||||||
hass_client: ClientSessionGenerator,
|
hass_client: ClientSessionGenerator,
|
||||||
mock_auth: Generator[None, AsyncMock, None],
|
mock_auth: Generator[None, AsyncMock, None],
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
):
|
):
|
||||||
"""Test timeout flow of the fix flow for legacy subscription."""
|
"""Test timeout flow of the fix flow for legacy subscription."""
|
||||||
aioclient_mock.post(
|
aioclient_mock.post(
|
||||||
|
@ -174,8 +174,6 @@ async def test_legacy_subscription_repair_flow_timeout(
|
||||||
status=403,
|
status=403,
|
||||||
)
|
)
|
||||||
|
|
||||||
issue_registry: ir.IssueRegistry = ir.async_get(hass)
|
|
||||||
|
|
||||||
cloud_repairs.async_manage_legacy_subscription_issue(hass, {"provider": "legacy"})
|
cloud_repairs.async_manage_legacy_subscription_issue(hass, {"provider": "legacy"})
|
||||||
repair_issue = issue_registry.async_get_issue(
|
repair_issue = issue_registry.async_get_issue(
|
||||||
domain="cloud", issue_id="legacy_subscription"
|
domain="cloud", issue_id="legacy_subscription"
|
||||||
|
|
|
@ -146,6 +146,7 @@ async def test_create_issue(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_write_config,
|
mock_write_config,
|
||||||
entity_registry_enabled_by_default: None,
|
entity_registry_enabled_by_default: None,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we create an issue when an automation or script is using a deprecated entity."""
|
"""Test we create an issue when an automation or script is using a deprecated entity."""
|
||||||
assert await async_setup_component(
|
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 automations_with_entity(hass, ENTITY_WATCH_TV)[0] == "automation.test"
|
||||||
assert scripts_with_entity(hass, ENTITY_WATCH_TV)[0] == "script.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(DOMAIN, "deprecated_switches")
|
||||||
assert issue_registry.async_get_issue(
|
assert issue_registry.async_get_issue(
|
||||||
|
|
|
@ -503,11 +503,12 @@ async def test_block_restored_climate_auth_error(
|
||||||
|
|
||||||
|
|
||||||
async def test_device_not_calibrated(
|
async def test_device_not_calibrated(
|
||||||
hass: HomeAssistant, mock_block_device, monkeypatch
|
hass: HomeAssistant,
|
||||||
|
mock_block_device,
|
||||||
|
monkeypatch,
|
||||||
|
issue_registry: ir.IssueRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test to create an issue when the device is not calibrated."""
|
"""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)
|
await init_integration(hass, 1, sleep_period=1000, model=MODEL_VALVE)
|
||||||
|
|
||||||
# Make device online
|
# Make device online
|
||||||
|
|
|
@ -250,11 +250,12 @@ async def test_block_sleeping_device_no_periodic_updates(
|
||||||
|
|
||||||
|
|
||||||
async def test_block_device_push_updates_failure(
|
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:
|
) -> None:
|
||||||
"""Test block device with push updates failure."""
|
"""Test block device with push updates failure."""
|
||||||
issue_registry: ir.IssueRegistry = ir.async_get(hass)
|
|
||||||
|
|
||||||
await init_integration(hass, 1)
|
await init_integration(hass, 1)
|
||||||
|
|
||||||
# Updates with COAP_REPLAY type should create an issue
|
# Updates with COAP_REPLAY type should create an issue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue