mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00: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:
parent
8277ebcbe1
commit
a2b280f342
@ -3,7 +3,6 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant import config_entries, data_entry_flow
|
|
||||||
from homeassistant.components import ios
|
from homeassistant.components import ios
|
||||||
from homeassistant.setup import async_setup_component
|
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",
|
"homeassistant.components.ios.sensor.async_setup_entry",
|
||||||
return_value=mock_coro(True),
|
return_value=mock_coro(True),
|
||||||
) as mock_setup:
|
) as mock_setup:
|
||||||
result = await hass.config_entries.flow.async_init(
|
assert await async_setup_component(hass, ios.DOMAIN, {ios.DOMAIN: {}})
|
||||||
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
|
|
||||||
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
assert len(mock_setup.mock_calls) == 1
|
||||||
@ -61,7 +51,7 @@ async def test_not_configuring_ios_not_creates_entry(hass):
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.ios.async_setup_entry", return_value=mock_coro(True)
|
"homeassistant.components.ios.async_setup_entry", return_value=mock_coro(True)
|
||||||
) as mock_setup:
|
) 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()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 0
|
assert len(mock_setup.mock_calls) == 0
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""List of modules that have uncaught exceptions today. Will be shrunk over time."""
|
"""List of modules that have uncaught exceptions today. Will be shrunk over time."""
|
||||||
IGNORE_UNCAUGHT_EXCEPTIONS = [
|
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"),
|
("tests.components.local_file.test_camera", "test_file_not_readable"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user