Fix exception in hunterdouglas_powerview with ignored config entry (#35482)

This commit is contained in:
J. Nick Koston 2020-05-11 00:06:31 -05:00 committed by GitHub
parent a6d587b6cd
commit 87e0f04515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -126,7 +126,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
def _host_already_configured(self, host):
"""See if we already have a hub with the host address configured."""
existing_hosts = {
entry.data[CONF_HOST] for entry in self._async_current_entries()
entry.data[CONF_HOST]
for entry in self._async_current_entries()
if CONF_HOST in entry.data
}
return host in existing_hosts

View File

@ -6,7 +6,7 @@ from homeassistant import config_entries, setup
from homeassistant.components.hunterdouglas_powerview.const import DOMAIN
from tests.async_mock import AsyncMock, MagicMock, patch
from tests.common import load_fixture
from tests.common import MockConfigEntry, load_fixture
def _get_mock_powerview_userdata(userdata=None, get_resources=None):
@ -102,6 +102,9 @@ async def test_form_homekit(hass):
"""Test we get the form with homekit source."""
await setup.async_setup_component(hass, "persistent_notification", {})
ignored_config_entry = MockConfigEntry(domain=DOMAIN, data={}, source="ignore")
ignored_config_entry.add_to_hass(hass)
mock_powerview_userdata = _get_mock_powerview_userdata()
with patch(
"homeassistant.components.hunterdouglas_powerview.UserData",