Apply changes from bond code review (#38303)

pull/38308/head
Eugene Prystupa 2020-07-27 22:18:24 -04:00 committed by GitHub
parent 02e2c40c48
commit 020dd39c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -1,13 +1,14 @@
"""Tests for the Bond module."""
from aiohttp import ClientConnectionError
import pytest
from homeassistant.components.bond import async_setup_entry
from homeassistant.components.bond.const import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED
from homeassistant.config_entries import (
ENTRY_STATE_LOADED,
ENTRY_STATE_NOT_LOADED,
ENTRY_STATE_SETUP_RETRY,
)
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
from homeassistant.setup import async_setup_component
@ -28,10 +29,11 @@ async def test_async_setup_raises_entry_not_ready(hass: HomeAssistant):
config_entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"},
)
config_entry.add_to_hass(hass)
with patch_bond_version(side_effect=ClientConnectionError()):
with pytest.raises(ConfigEntryNotReady):
await async_setup_entry(hass, config_entry)
await hass.config_entries.async_setup(config_entry.entry_id)
assert config_entry.state == ENTRY_STATE_SETUP_RETRY
async def test_async_setup_entry_sets_up_hub_and_supported_domains(hass: HomeAssistant):