1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Use MockConfigEntry (#25190)

This commit is contained in:
Andrew Sayre
2019-07-16 17:51:30 -04:00
committed by Paulus Schoutsen
parent de3d28d9d5
commit 20301ae888
4 changed files with 30 additions and 29 deletions

View File

@@ -13,7 +13,8 @@ from homeassistant.components.smartthings.config_flow import (
from homeassistant.components.smartthings.const import (
CONF_INSTALLED_APP_ID, CONF_INSTALLED_APPS, CONF_LOCATION_ID,
CONF_REFRESH_TOKEN, DOMAIN)
from homeassistant.config_entries import ConfigEntry
from tests.common import MockConfigEntry
async def test_step_user(hass):
@@ -64,13 +65,10 @@ async def test_token_already_setup(hass):
flow = SmartThingsFlowHandler()
flow.hass = hass
token = str(uuid4())
entries = [ConfigEntry(
version='', domain='', title='', data={'access_token': token},
source='', connection_class='')]
entry = MockConfigEntry(domain=DOMAIN, data={'access_token': token})
entry.add_to_hass(hass)
with patch.object(hass.config_entries, 'async_entries',
return_value=entries):
result = await flow.async_step_user({'access_token': token})
result = await flow.async_step_user({'access_token': token})
assert result['type'] == data_entry_flow.RESULT_TYPE_FORM
assert result['step_id'] == 'user'