Add config entries to connection class (#16618)
This commit is contained in:
1 parent
3e0c6c176a
commit
201fd4afee
24 files changed
+104
-63
No files matched your search
@@ -42,7 +42,8 @@ async def setup_bridge(hass, data, allow_clip_sensor=True):
|
||||
hass.data[deconz.DATA_DECONZ_ID] = {}
|
||||
config_entry = config_entries.ConfigEntry(
|
||||
1, deconz.DOMAIN, 'Mock Title',
|
||||
{'host': 'mock-host', 'allow_clip_sensor': allow_clip_sensor}, 'test')
|
||||
{'host': 'mock-host', 'allow_clip_sensor': allow_clip_sensor}, 'test',
|
||||
config_entries.CONN_CLASS_LOCAL_PUSH)
|
||||
await hass.config_entries.async_forward_entry_setup(
|
||||
config_entry, 'binary_sensor')
|
||||
# To flush out the service call to update the group
|
||||
|
||||
@@ -9,7 +9,6 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries as core_ce
|
||||
from homeassistant.config_entries import HANDLERS
|
||||
from homeassistant.data_entry_flow import FlowHandler
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components.config import config_entries
|
||||
from homeassistant.loader import set_component
|
||||
@@ -37,13 +36,15 @@ def test_get_entries(hass, client):
|
||||
MockConfigEntry(
|
||||
domain='comp',
|
||||
title='Test 1',
|
||||
source='bla'
|
||||
source='bla',
|
||||
connection_class=core_ce.CONN_CLASS_LOCAL_POLL,
|
||||
).add_to_hass(hass)
|
||||
MockConfigEntry(
|
||||
domain='comp2',
|
||||
title='Test 2',
|
||||
source='bla2',
|
||||
state=core_ce.ENTRY_STATE_LOADED,
|
||||
connection_class=core_ce.CONN_CLASS_ASSUMED,
|
||||
).add_to_hass(hass)
|
||||
resp = yield from client.get('/api/config/config_entries/entry')
|
||||
assert resp.status == 200
|
||||
@@ -55,13 +56,15 @@ def test_get_entries(hass, client):
|
||||
'domain': 'comp',
|
||||
'title': 'Test 1',
|
||||
'source': 'bla',
|
||||
'state': 'not_loaded'
|
||||
'state': 'not_loaded',
|
||||
'connection_class': 'local_poll',
|
||||
},
|
||||
{
|
||||
'domain': 'comp2',
|
||||
'title': 'Test 2',
|
||||
'source': 'bla2',
|
||||
'state': 'loaded',
|
||||
'connection_class': 'assumed',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -100,7 +103,7 @@ def test_available_flows(hass, client):
|
||||
@asyncio.coroutine
|
||||
def test_initialize_flow(hass, client):
|
||||
"""Test we can initialize a flow."""
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
@asyncio.coroutine
|
||||
def async_step_user(self, user_input=None):
|
||||
schema = OrderedDict()
|
||||
@@ -155,7 +158,7 @@ def test_initialize_flow(hass, client):
|
||||
@asyncio.coroutine
|
||||
def test_abort(hass, client):
|
||||
"""Test a flow that aborts."""
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
@asyncio.coroutine
|
||||
def async_step_user(self, user_input=None):
|
||||
return self.async_abort(reason='bla')
|
||||
@@ -181,7 +184,7 @@ def test_create_account(hass, client):
|
||||
hass, 'test',
|
||||
MockModule('test', async_setup_entry=mock_coro_func(True)))
|
||||
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
VERSION = 1
|
||||
|
||||
@asyncio.coroutine
|
||||
@@ -213,7 +216,7 @@ def test_two_step_flow(hass, client):
|
||||
hass, 'test',
|
||||
MockModule('test', async_setup_entry=mock_coro_func(True)))
|
||||
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
VERSION = 1
|
||||
|
||||
@asyncio.coroutine
|
||||
@@ -269,7 +272,7 @@ def test_two_step_flow(hass, client):
|
||||
@asyncio.coroutine
|
||||
def test_get_progress_index(hass, client):
|
||||
"""Test querying for the flows that are in progress."""
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
VERSION = 5
|
||||
|
||||
@asyncio.coroutine
|
||||
@@ -301,7 +304,7 @@ def test_get_progress_index(hass, client):
|
||||
@asyncio.coroutine
|
||||
def test_get_progress_flow(hass, client):
|
||||
"""Test we can query the API for same result as we get from init a flow."""
|
||||
class TestFlow(FlowHandler):
|
||||
class TestFlow(core_ce.ConfigFlow):
|
||||
@asyncio.coroutine
|
||||
def async_step_user(self, user_input=None):
|
||||
schema = OrderedDict()
|
||||
|
||||
@@ -64,7 +64,7 @@ async def setup_bridge(hass, data, allow_deconz_groups=True):
|
||||
config_entry = config_entries.ConfigEntry(
|
||||
1, deconz.DOMAIN, 'Mock Title',
|
||||
{'host': 'mock-host', 'allow_deconz_groups': allow_deconz_groups},
|
||||
'test')
|
||||
'test', config_entries.CONN_CLASS_LOCAL_PUSH)
|
||||
await hass.config_entries.async_forward_entry_setup(config_entry, 'light')
|
||||
# To flush out the service call to update the group
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -199,7 +199,7 @@ async def setup_bridge(hass, mock_bridge):
|
||||
hass.data[hue.DOMAIN] = {'mock-host': mock_bridge}
|
||||
config_entry = config_entries.ConfigEntry(1, hue.DOMAIN, 'Mock Title', {
|
||||
'host': 'mock-host'
|
||||
}, 'test')
|
||||
}, 'test', config_entries.CONN_CLASS_LOCAL_POLL)
|
||||
await hass.config_entries.async_forward_entry_setup(config_entry, 'light')
|
||||
# To flush out the service call to update the group
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -36,7 +36,8 @@ async def setup_bridge(hass, data):
|
||||
hass.data[deconz.DATA_DECONZ_UNSUB] = []
|
||||
hass.data[deconz.DATA_DECONZ_ID] = {}
|
||||
config_entry = config_entries.ConfigEntry(
|
||||
1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test')
|
||||
1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test',
|
||||
config_entries.CONN_CLASS_LOCAL_PUSH)
|
||||
await hass.config_entries.async_forward_entry_setup(config_entry, 'scene')
|
||||
# To flush out the service call to update the group
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -58,7 +58,8 @@ async def setup_bridge(hass, data, allow_clip_sensor=True):
|
||||
hass.data[deconz.DATA_DECONZ_ID] = {}
|
||||
config_entry = config_entries.ConfigEntry(
|
||||
1, deconz.DOMAIN, 'Mock Title',
|
||||
{'host': 'mock-host', 'allow_clip_sensor': allow_clip_sensor}, 'test')
|
||||
{'host': 'mock-host', 'allow_clip_sensor': allow_clip_sensor}, 'test',
|
||||
config_entries.CONN_CLASS_LOCAL_PUSH)
|
||||
await hass.config_entries.async_forward_entry_setup(config_entry, 'sensor')
|
||||
# To flush out the service call to update the group
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -54,7 +54,8 @@ async def setup_bridge(hass, data):
|
||||
hass.data[deconz.DATA_DECONZ_UNSUB] = []
|
||||
hass.data[deconz.DATA_DECONZ_ID] = {}
|
||||
config_entry = config_entries.ConfigEntry(
|
||||
1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test')
|
||||
1, deconz.DOMAIN, 'Mock Title', {'host': 'mock-host'}, 'test',
|
||||
config_entries.CONN_CLASS_LOCAL_PUSH)
|
||||
await hass.config_entries.async_forward_entry_setup(config_entry, 'switch')
|
||||
# To flush out the service call to update the group
|
||||
await hass.async_block_till_done()
|
||||
|
||||
Reference in new issue
Block a user