mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 23:07:09 +00:00
Apply changes from bond code review (#38303)
This commit is contained in:
parent
02e2c40c48
commit
020dd39c08
@ -1,13 +1,14 @@
|
|||||||
"""Tests for the Bond module."""
|
"""Tests for the Bond module."""
|
||||||
from aiohttp import ClientConnectionError
|
from aiohttp import ClientConnectionError
|
||||||
import pytest
|
|
||||||
|
|
||||||
from homeassistant.components.bond import async_setup_entry
|
|
||||||
from homeassistant.components.bond.const import DOMAIN
|
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.const import CONF_ACCESS_TOKEN, CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
from homeassistant.setup import async_setup_component
|
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(
|
config_entry = MockConfigEntry(
|
||||||
domain=DOMAIN, data={CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"},
|
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 patch_bond_version(side_effect=ClientConnectionError()):
|
||||||
with pytest.raises(ConfigEntryNotReady):
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await async_setup_entry(hass, config_entry)
|
assert config_entry.state == ENTRY_STATE_SETUP_RETRY
|
||||||
|
|
||||||
|
|
||||||
async def test_async_setup_entry_sets_up_hub_and_supported_domains(hass: HomeAssistant):
|
async def test_async_setup_entry_sets_up_hub_and_supported_domains(hass: HomeAssistant):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user