Add config entries to connection class (#16618)

This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2018-09-17 10:12:46 +02:00
1 parent 3e0c6c176a
commit 201fd4afee
24 files changed
+104 -63

No files matched your search

+12 -9
View File
@@ -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()