1
mirror of https://github.com/home-assistant/core synced 2024-09-18 19:55:20 +02:00

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 <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>
This commit is contained in:
Ziv 2020-04-17 11:25:31 +03:00 committed by GitHub
parent 8277ebcbe1
commit a2b280f342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View File

@ -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

View File

@ -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"),
]