mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Ensure async_setup is mocked in geonetnz intergration tests (#37426)
* Ensure async_setup is mocked in geonetnz intergration tests * s/asynctest/tests.async_mock/g
This commit is contained in:
parent
cd5f6a0c56
commit
3eb6a68d12
@ -15,6 +15,8 @@ from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_duplicate_error(hass, config_entry):
|
||||
"""Test that errors are shown when duplicates are added."""
|
||||
@ -49,9 +51,12 @@ async def test_step_import(hass):
|
||||
CONF_MINIMUM_MAGNITUDE: 2.5,
|
||||
}
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": "import"}, data=conf
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.geonetnz_quakes.async_setup_entry", return_value=True
|
||||
), patch("homeassistant.components.geonetnz_quakes.async_setup", return_value=True):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": "import"}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
@ -71,9 +76,12 @@ async def test_step_user(hass):
|
||||
hass.config.longitude = 174.7
|
||||
conf = {CONF_RADIUS: 25, CONF_MMI: 4}
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": "user"}, data=conf
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.geonetnz_quakes.async_setup_entry", return_value=True
|
||||
), patch("homeassistant.components.geonetnz_quakes.async_setup", return_value=True):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": "user"}, data=conf
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
|
@ -11,6 +11,8 @@ from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM,
|
||||
)
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
|
||||
async def test_duplicate_error(hass, config_entry):
|
||||
"""Test that errors are shown when duplicates are added."""
|
||||
@ -48,7 +50,12 @@ async def test_step_import(hass):
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_import(import_config=conf)
|
||||
with patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup_entry", return_value=True
|
||||
), patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
):
|
||||
result = await flow.async_step_import(import_config=conf)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
@ -69,7 +76,12 @@ async def test_step_user(hass):
|
||||
flow = config_flow.GeonetnzVolcanoFlowHandler()
|
||||
flow.hass = hass
|
||||
|
||||
result = await flow.async_step_user(user_input=conf)
|
||||
with patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup_entry", return_value=True
|
||||
), patch(
|
||||
"homeassistant.components.geonetnz_volcano.async_setup", return_value=True
|
||||
):
|
||||
result = await flow.async_step_user(user_input=conf)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "-41.2, 174.7"
|
||||
assert result["data"] == {
|
||||
|
Loading…
x
Reference in New Issue
Block a user