Fix name conflict in tests (#22556)

* Fix name conflict in tests

* Lint

* Lint
pull/22563/head
Jason Hu 2019-03-30 08:30:21 -07:00 committed by GitHub
parent ecba87179f
commit 64306922b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 14 deletions

View File

@ -31,10 +31,30 @@ def client(hass, hass_client):
yield hass.loop.run_until_complete(hass_client())
@HANDLERS.register('comp1')
class Comp1ConfigFlow:
"""Config flow with options flow."""
@staticmethod
@callback
def async_get_options_flow(config, options):
"""Get options flow."""
pass
@HANDLERS.register('comp2')
class Comp2ConfigFlow:
"""Config flow without options flow."""
def __init__(self):
"""Init."""
pass
async def test_get_entries(hass, client):
"""Test get entries."""
MockConfigEntry(
domain='comp',
domain='comp1',
title='Test 1',
source='bla',
connection_class=core_ce.CONN_CLASS_LOCAL_POLL,
@ -47,18 +67,6 @@ async def test_get_entries(hass, client):
connection_class=core_ce.CONN_CLASS_ASSUMED,
).add_to_hass(hass)
class CompConfigFlow:
@staticmethod
@callback
def async_get_options_flow(config, options):
pass
HANDLERS['comp'] = CompConfigFlow()
class Comp2ConfigFlow:
def __init__(self):
pass
HANDLERS['comp2'] = Comp2ConfigFlow()
resp = await client.get('/api/config/config_entries/entry')
assert resp.status == 200
data = await resp.json()
@ -66,7 +74,7 @@ async def test_get_entries(hass, client):
entry.pop('entry_id')
assert data == [
{
'domain': 'comp',
'domain': 'comp1',
'title': 'Test 1',
'source': 'bla',
'state': 'not_loaded',