mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Use return_value in Flu Near You config flow tests (#64596)
This commit is contained in:
parent
b2811cff51
commit
ff535053a9
@ -38,7 +38,7 @@ def data_cdc_fixture():
|
||||
async def setup_flunearyou_fixture(hass, config, data_cdc):
|
||||
"""Define a fixture to set up Flu Near You."""
|
||||
with patch(
|
||||
"pyflunearyou.cdc.CdcReport.status_by_coordinates", side_effect=data_cdc
|
||||
"pyflunearyou.cdc.CdcReport.status_by_coordinates", return_value=data_cdc
|
||||
), patch("pyflunearyou.user.UserReport.status_by_coordinates"), patch(
|
||||
"homeassistant.components.flunearyou.PLATFORMS", []
|
||||
):
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Define tests for the flunearyou config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyflunearyou.errors import FluNearYouError
|
||||
import pytest
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.flunearyou import DOMAIN
|
||||
@ -17,9 +18,11 @@ async def test_duplicate_error(hass, config, config_entry, setup_flunearyou):
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("data_cdc", [FluNearYouError])
|
||||
async def test_errors(hass, config, data_cdc, setup_flunearyou):
|
||||
async def test_errors(hass, config):
|
||||
"""Test that exceptions show the appropriate error."""
|
||||
with patch(
|
||||
"pyflunearyou.cdc.CdcReport.status_by_coordinates", side_effect=FluNearYouError
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=config
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user