Skip to content

Commit

Permalink
Fix uncaught exceptions in ios (home-assistant#34119)
Browse files Browse the repository at this point in the history
* 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 <marhje52@gmail.com>

* Update tests/components/ios/test_init.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* changed the test per suggestions

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
  • Loading branch information
ziv1234 and MartinHjelmare authored Apr 17, 2020
1 parent 8277ebc commit a2b280f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 2 additions & 12 deletions tests/components/ios/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pytest

from homeassistant import config_entries, data_entry_flow
from homeassistant.components import ios
from homeassistant.setup import async_setup_component

Expand All @@ -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
Expand All @@ -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
2 changes: 0 additions & 2 deletions tests/ignore_uncaught_exceptions.py
Original file line number Diff line number Diff line change
@@ -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"),
]

Expand Down

0 comments on commit a2b280f

Please sign in to comment.