From a2b280f342eeae0be9ce43c001b2e5326282ef12 Mon Sep 17 00:00:00 2001 From: Ziv <16467659+ziv1234@users.noreply.github.com> Date: Fri, 17 Apr 2020 11:25:31 +0300 Subject: [PATCH] Fix uncaught exceptions in ios (#34119) * verify that the config in hass is not empty * changed to use MockConfigEntry * Update tests/components/ios/test_init.py Co-Authored-By: Martin Hjelmare * Update tests/components/ios/test_init.py Co-Authored-By: Martin Hjelmare * changed the test per suggestions Co-authored-by: Martin Hjelmare --- tests/components/ios/test_init.py | 14 ++------------ tests/ignore_uncaught_exceptions.py | 2 -- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/components/ios/test_init.py b/tests/components/ios/test_init.py index 31eb43fc611b..5fe796bae20e 100644 --- a/tests/components/ios/test_init.py +++ b/tests/components/ios/test_init.py @@ -3,7 +3,6 @@ from unittest.mock import patch import pytest -from homeassistant import config_entries, data_entry_flow from homeassistant.components import ios from homeassistant.setup import async_setup_component @@ -30,16 +29,7 @@ async def test_creating_entry_sets_up_sensor(hass): "homeassistant.components.ios.sensor.async_setup_entry", return_value=mock_coro(True), ) as mock_setup: - result = await hass.config_entries.flow.async_init( - ios.DOMAIN, context={"source": config_entries.SOURCE_USER} - ) - - # Confirmation form - assert result["type"] == data_entry_flow.RESULT_TYPE_FORM - - result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - + assert await async_setup_component(hass, ios.DOMAIN, {ios.DOMAIN: {}}) await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 1 @@ -61,7 +51,7 @@ async def test_not_configuring_ios_not_creates_entry(hass): with patch( "homeassistant.components.ios.async_setup_entry", return_value=mock_coro(True) ) as mock_setup: - await async_setup_component(hass, ios.DOMAIN, {}) + await async_setup_component(hass, ios.DOMAIN, {"foo": "bar"}) await hass.async_block_till_done() assert len(mock_setup.mock_calls) == 0 diff --git a/tests/ignore_uncaught_exceptions.py b/tests/ignore_uncaught_exceptions.py index 8e6004d362e1..d8734ab73163 100644 --- a/tests/ignore_uncaught_exceptions.py +++ b/tests/ignore_uncaught_exceptions.py @@ -1,7 +1,5 @@ """List of modules that have uncaught exceptions today. Will be shrunk over time.""" IGNORE_UNCAUGHT_EXCEPTIONS = [ - ("tests.components.ios.test_init", "test_creating_entry_sets_up_sensor"), - ("tests.components.ios.test_init", "test_not_configuring_ios_not_creates_entry"), ("tests.components.local_file.test_camera", "test_file_not_readable"), ]