mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Fix use of issue registry in anglian water (#177350)
This commit is contained in:
@@ -301,6 +301,7 @@ async def test_coordinator_update_failed_errors(
|
||||
async def test_coordinator_consent_required_error(
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_anglian_water_client: AsyncMock,
|
||||
) -> None:
|
||||
@@ -316,15 +317,12 @@ async def test_coordinator_consent_required_error(
|
||||
assert exc_info.value.translation_domain == DOMAIN
|
||||
assert exc_info.value.translation_key == "consent_required"
|
||||
assert exc_info.value.retry_after == 900.0
|
||||
assert (
|
||||
ir.async_get(hass).async_get_issue(DOMAIN, CONSENT_REQUIRED_ISSUE_ID)
|
||||
is not None
|
||||
)
|
||||
assert issue_registry.async_get_issue(DOMAIN, CONSENT_REQUIRED_ISSUE_ID) is not None
|
||||
|
||||
mock_anglian_water_client.update.side_effect = None
|
||||
await coordinator._async_update_data()
|
||||
await async_wait_recording_done(hass)
|
||||
assert ir.async_get(hass).async_get_issue(DOMAIN, CONSENT_REQUIRED_ISSUE_ID) is None
|
||||
assert issue_registry.async_get_issue(DOMAIN, CONSENT_REQUIRED_ISSUE_ID) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -83,6 +83,7 @@ async def test_setup_auth_failures(
|
||||
async def test_setup_consent_required(
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_anglian_water_client: AsyncMock,
|
||||
mock_anglian_water_authenticator: MagicMock,
|
||||
@@ -98,7 +99,6 @@ async def test_setup_consent_required(
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert issue_registry.async_get_issue(DOMAIN, CONSENT_REQUIRED_ISSUE_ID) is not None
|
||||
|
||||
# Test that the issue is deleted once consent is granted
|
||||
|
||||
Reference in New Issue
Block a user