Ambiclimate test, mock (#24034)

This commit is contained in:
Daniel Høyer Iversen 2019-05-22 15:00:05 +02:00 committed by Pascal Vizeli
parent 806903ffe0
commit 6b3bb3347b

View file

@ -86,12 +86,14 @@ async def test_full_flow_implementation(hass):
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
async def test_abort_no_code(hass):
async def test_abort_invalid_code(hass):
"""Test if no code is given to step_code."""
config_flow.register_flow_implementation(hass, None, None)
flow = await init_config_flow(hass)
result = await flow.async_step_code('invalid')
with patch('ambiclimate.AmbiclimateOAuth.get_access_token',
return_value=mock_coro(None)):
result = await flow.async_step_code('invalid')
assert result['type'] == data_entry_flow.RESULT_TYPE_ABORT
assert result['reason'] == 'access_token'