core/tests/components/rova/test_init.py
2024-03-27 15:51:49 +01:00

26 lines
862 B
Python

"""Tests for the Rova integration init."""
from unittest.mock import MagicMock
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir
from tests.common import MockConfigEntry
async def test_issue_if_not_rova_area(
hass: HomeAssistant,
mock_rova: MagicMock,
mock_config_entry: MockConfigEntry,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test we create an issue if rova does not collect at the given address."""
mock_rova.is_rova_area.return_value = False
mock_config_entry.add_to_hass(hass)
assert not await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert mock_config_entry.state == ConfigEntryState.SETUP_ERROR
assert len(issue_registry.issues) == 1