Don't directly update config entries (#20877)
* Don't directly update config entries * Use ConfigEntryNotReady * Fix tests * Remove old test * Lint
This commit is contained in:
1 parent
161c368c9d
commit
882f5ed079
11 files changed
+54
-169
No files matched your search
@@ -4,6 +4,7 @@ from unittest.mock import Mock, patch
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import deconz
|
||||
|
||||
@@ -79,9 +80,11 @@ async def test_setup_entry_no_available_bridge(hass):
|
||||
"""Test setup entry fails if deCONZ is not available."""
|
||||
entry = Mock()
|
||||
entry.data = {'host': '1.2.3.4', 'port': 80, 'api_key': '1234567890ABCDEF'}
|
||||
with patch('pydeconz.DeconzSession.async_load_parameters',
|
||||
return_value=mock_coro(False)):
|
||||
assert await deconz.async_setup_entry(hass, entry) is False
|
||||
with patch(
|
||||
'pydeconz.DeconzSession.async_load_parameters',
|
||||
return_value=mock_coro(False)
|
||||
), pytest.raises(ConfigEntryNotReady):
|
||||
await deconz.async_setup_entry(hass, entry)
|
||||
|
||||
|
||||
async def test_setup_entry_successful(hass):
|
||||
|
||||
Reference in new issue
Block a user