mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Return None from config entry method mocks in integration tests (batch 14: sleep_as_android–swiss_public_transport) (#187830)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
796ce7767f
commit
c09dcd2990
@@ -14,7 +14,7 @@ from homeassistant.const import CONF_WEBHOOK_ID
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sleep_as_android.async_setup_entry", return_value=True
|
||||
"homeassistant.components.sleep_as_android.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ SLEEPIQ_CONFIG = {
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sleepiq.async_setup_entry", return_value=True
|
||||
"homeassistant.components.sleepiq.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ def mock_slide_api() -> Generator[AsyncMock]:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.slide_local.async_setup_entry", return_value=True
|
||||
"homeassistant.components.slide_local.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -24,6 +24,6 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch(
|
||||
"homeassistant.components.slimproto.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup:
|
||||
yield mock_setup
|
||||
|
||||
@@ -37,7 +37,7 @@ def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Mock the setup entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sma.async_setup_entry", return_value=True
|
||||
"homeassistant.components.sma.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ async def test_full_user_flow(
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.smappee.async_setup_entry", return_value=True
|
||||
"homeassistant.components.smappee.async_setup_entry", return_value=None
|
||||
) as mock_setup:
|
||||
await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
|
||||
@@ -498,7 +498,7 @@ async def test_full_zeroconf_flow(hass: HomeAssistant) -> None:
|
||||
"pysmappee.api.SmappeeLocalApi.load_instantaneous",
|
||||
return_value=[{"key": "phase0ActivePower", "value": 0}],
|
||||
),
|
||||
patch("homeassistant.components.smappee.async_setup_entry", return_value=True),
|
||||
patch("homeassistant.components.smappee.async_setup_entry", return_value=None),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
@@ -544,7 +544,7 @@ async def test_full_user_local_flow(hass: HomeAssistant) -> None:
|
||||
"pysmappee.api.SmappeeLocalApi.load_instantaneous",
|
||||
return_value=[{"key": "phase0ActivePower", "value": 0}],
|
||||
),
|
||||
patch("homeassistant.components.smappee.async_setup_entry", return_value=True),
|
||||
patch("homeassistant.components.smappee.async_setup_entry", return_value=None),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
@@ -666,7 +666,7 @@ async def test_reauth_flow(
|
||||
},
|
||||
)
|
||||
|
||||
with patch("homeassistant.components.smappee.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.smappee.async_setup_entry", return_value=None):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
|
||||
@@ -29,7 +29,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator:
|
||||
"""Override async_setup_entry."""
|
||||
with patch("homeassistant.components.smarla.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.smarla.async_setup_entry", return_value=None):
|
||||
yield
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ def _patch_success() -> Generator[None]:
|
||||
patch("smart_meter_texas.Client.authenticate", return_value=True),
|
||||
patch(
|
||||
"homeassistant.components.smart_meter_texas.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
yield
|
||||
@@ -47,7 +47,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
patch("smart_meter_texas.Client.authenticate", return_value=True),
|
||||
patch(
|
||||
"homeassistant.components.smart_meter_texas.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
||||
@@ -40,7 +40,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.smartthings.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ def mock_setup_entry():
|
||||
"""Mock the integration setup."""
|
||||
with patch(
|
||||
"homeassistant.components.smarttub.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock:
|
||||
yield mock
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override integration setup."""
|
||||
with patch(
|
||||
"homeassistant.components.smarty.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ WEBHOOK_SECRET = "top-secret"
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.smartyplants.async_setup_entry", return_value=True
|
||||
"homeassistant.components.smartyplants.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from . import TEST_CONFIG
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.smhi.async_setup_entry", return_value=True
|
||||
"homeassistant.components.smhi.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ async def test_form(
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.smhi.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
||||
@@ -93,7 +93,7 @@ async def mock_patch_platforms(platforms: list[str]) -> AsyncGenerator[None]:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.smlight.async_setup_entry", return_value=True
|
||||
"homeassistant.components.smlight.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ USER_INPUT = {
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.smtp.async_setup_entry", return_value=True
|
||||
"homeassistant.components.smtp.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.snapcast.async_setup_entry", return_value=True
|
||||
"homeassistant.components.snapcast.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from .const import MOCK_SNOO_DEVICES, MOCKED_AUTH
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.snoo.async_setup_entry", return_value=True
|
||||
"homeassistant.components.snoo.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) -
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
with patch("homeassistant.components.snooz.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.snooz.async_setup_entry", return_value=None):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_NAME: TEST_SNOOZ_DISPLAY_NAME},
|
||||
@@ -359,7 +359,7 @@ async def _test_pairs_timeout(
|
||||
async def _test_setup_entry(
|
||||
hass: HomeAssistant, flow_id: str, user_input: dict | None = None
|
||||
) -> None:
|
||||
with patch("homeassistant.components.snooz.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.snooz.async_setup_entry", return_value=None):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
flow_id,
|
||||
user_input=user_input or {},
|
||||
|
||||
@@ -19,7 +19,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
with patch(
|
||||
"homeassistant.components.sofar.async_setup_entry",
|
||||
new_callable=AsyncMock,
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.solaredge.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ def mock_solarlog_connector():
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.solarlog.async_setup_entry", return_value=True
|
||||
"homeassistant.components.solarlog.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -65,6 +65,6 @@ def mock_solarman(device_fixture: str) -> Generator[AsyncMock]:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.solarman.async_setup_entry", return_value=True
|
||||
"homeassistant.components.solarman.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -78,7 +78,7 @@ async def test_form_success(
|
||||
patch("solax.RealTimeAPI.get_data", return_value=__mock_get_data()),
|
||||
patch(
|
||||
"homeassistant.components.solax.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result = flow
|
||||
@@ -133,7 +133,7 @@ async def test_form_discover_error(
|
||||
patch("solax.RealTimeAPI.get_data", return_value=__mock_get_data()),
|
||||
patch(
|
||||
"homeassistant.components.solax.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@@ -202,7 +202,7 @@ async def test_form_finalize_error(
|
||||
patch("solax.RealTimeAPI.get_data", return_value=__mock_get_data()),
|
||||
patch(
|
||||
"homeassistant.components.solax.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
||||
@@ -36,7 +36,7 @@ def _patch_success() -> Generator[None]:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.somfy_mylink.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
yield
|
||||
@@ -58,7 +58,7 @@ async def test_form_user(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.somfy_mylink.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -103,7 +103,7 @@ async def test_form_user_already_configured(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.somfy_mylink.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -291,7 +291,7 @@ async def test_form_user_already_configured_from_dhcp(hass: HomeAssistant) -> No
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.somfy_mylink.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@@ -352,7 +352,7 @@ async def test_dhcp_discovery(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.somfy_mylink.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
||||
@@ -127,7 +127,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[None]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch("homeassistant.components.sonarr.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.sonarr.async_setup_entry", return_value=None):
|
||||
yield
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ async def test_migrate_config_entry(hass: HomeAssistant) -> None:
|
||||
assert entry.version == 1
|
||||
assert not entry.unique_id
|
||||
|
||||
with patch("homeassistant.components.sonarr.async_setup_entry", return_value=True):
|
||||
with patch("homeassistant.components.sonarr.async_setup_entry", return_value=None):
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ def _flow_next(hass: HomeAssistant, flow_id: str) -> ConfigFlowResult:
|
||||
def _patch_setup():
|
||||
return patch(
|
||||
"homeassistant.components.songpal.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ async def test_user_form(
|
||||
) as mock_setup,
|
||||
patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -71,7 +71,7 @@ async def test_user_form_already_created(hass: HomeAssistant) -> None:
|
||||
config = {DOMAIN: {MP_DOMAIN: {CONF_HOSTS: "192.168.4.2"}}}
|
||||
with patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
):
|
||||
await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
@@ -104,7 +104,7 @@ async def test_zeroconf_form(
|
||||
) as mock_setup,
|
||||
patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -166,7 +166,7 @@ async def test_ssdp_discovery(hass: HomeAssistant, soco) -> None:
|
||||
) as mock_setup,
|
||||
patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@@ -220,7 +220,7 @@ async def test_zeroconf_sonos_v1(hass: HomeAssistant) -> None:
|
||||
) as mock_setup,
|
||||
patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
|
||||
@@ -72,7 +72,7 @@ async def test_configuring_sonos_creates_entry(hass: HomeAssistant) -> None:
|
||||
"""Test that specifying config will create an entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup:
|
||||
await async_setup_component(
|
||||
hass,
|
||||
@@ -88,7 +88,7 @@ async def test_not_configuring_sonos_not_creates_entry(hass: HomeAssistant) -> N
|
||||
"""Test that no config will not create an entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sonos.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup:
|
||||
await async_setup_component(hass, sonos.DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -30,7 +30,7 @@ async def test_user_flow_create_entry(
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=True
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -70,7 +70,7 @@ async def test_user_flow_cannot_connect(
|
||||
|
||||
requests_mock.get(f"{DEVICE_1_URL}/info", text=device1_info)
|
||||
with patch(
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=True
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=None
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_HOST: DEVICE_1_IP}
|
||||
@@ -107,7 +107,7 @@ async def test_zeroconf_flow_create_entry(
|
||||
assert result.get("description_placeholders") == {"name": DEVICE_1_NAME}
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=True
|
||||
"homeassistant.components.soundtouch.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
|
||||
@@ -187,11 +187,10 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
async def setup_entry(
|
||||
_hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
) -> bool:
|
||||
) -> None:
|
||||
runtime_data = MagicMock()
|
||||
runtime_data.async_shutdown = AsyncMock()
|
||||
entry.runtime_data = runtime_data
|
||||
return True
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.specialized_turbo.async_setup_entry",
|
||||
|
||||
@@ -12,7 +12,7 @@ def mock_setup_entry():
|
||||
"""Mock setting up a config entry."""
|
||||
with patch(
|
||||
"homeassistant.components.speedtestdotnet.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup:
|
||||
yield mock_setup
|
||||
|
||||
|
||||
@@ -120,6 +120,6 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Stop the entry a flow creates from setting the integration up."""
|
||||
with patch(
|
||||
"homeassistant.components.spin_ble.async_setup_entry", return_value=True
|
||||
"homeassistant.components.spin_ble.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -20,7 +20,7 @@ from homeassistant.const import (
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.splunk.async_setup_entry", return_value=True
|
||||
"homeassistant.components.splunk.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ async def test_full_flow(
|
||||
)
|
||||
|
||||
with (
|
||||
patch("homeassistant.components.spotify.async_setup_entry", return_value=True),
|
||||
patch("homeassistant.components.spotify.async_setup_entry", return_value=None),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
|
||||
@@ -228,7 +228,7 @@ async def test_reauthentication(
|
||||
)
|
||||
|
||||
with (
|
||||
patch("homeassistant.components.spotify.async_setup_entry", return_value=True),
|
||||
patch("homeassistant.components.spotify.async_setup_entry", return_value=None),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ import pytest
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sql.async_setup_entry", return_value=True
|
||||
"homeassistant.components.sql.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -120,7 +120,7 @@ async def test_form_with_query_template(
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.sql.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -172,7 +172,7 @@ async def test_form_with_broken_query_template(
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.sql.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
||||
@@ -121,7 +121,7 @@ FAKE_QUERY_RESPONSE = {
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.squeezebox.async_setup_entry", return_value=True
|
||||
"homeassistant.components.squeezebox.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -122,6 +122,6 @@ async def init_integration(
|
||||
def mock_setup_entry() -> Generator[MagicMock]:
|
||||
"""Mock async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.srp_energy.async_setup_entry", return_value=True
|
||||
"homeassistant.components.srp_energy.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -46,7 +46,7 @@ async def test_show_form(
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.srp_energy.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
flow_id=result["flow_id"], user_input=TEST_CONFIG_HOME
|
||||
|
||||
@@ -139,7 +139,7 @@ async def test_step_auth_app_code_falls(hass: HomeAssistant) -> None:
|
||||
assert result["step_id"] == "auth_user"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.starline.async_setup_entry", return_value=True
|
||||
"homeassistant.components.starline.async_setup_entry", return_value=None
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -191,7 +191,7 @@ async def test_step_auth_app_token_falls(hass: HomeAssistant) -> None:
|
||||
assert result["step_id"] == "auth_user"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.starline.async_setup_entry", return_value=True
|
||||
"homeassistant.components.starline.async_setup_entry", return_value=None
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
||||
@@ -8,7 +8,7 @@ from pytest_homeassistant.common import (
|
||||
)
|
||||
|
||||
SETUP_ENTRY_PATCHER = patch(
|
||||
"homeassistant.components.starlink.async_setup_entry", return_value=True
|
||||
"homeassistant.components.starlink.async_setup_entry", return_value=None
|
||||
)
|
||||
|
||||
LOCATION_DATA_SUCCESS_PATCHER = patch(
|
||||
|
||||
@@ -35,7 +35,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Automatically path uuid generator."""
|
||||
with patch(
|
||||
"homeassistant.components.statistics.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.steam_online.async_setup_entry", return_value=True
|
||||
"homeassistant.components.steam_online.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.steamist.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -87,7 +87,7 @@ async def test_form_with_discovery(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.steamist.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -132,7 +132,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.steamist.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
@@ -172,7 +172,7 @@ async def test_form_unknown_exception(hass: HomeAssistant) -> None:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.steamist.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
@@ -220,7 +220,7 @@ async def test_discovery(hass: HomeAssistant) -> None:
|
||||
_patch_discovery(),
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True) as mock_setup,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=True) as mock_setup_entry,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=None) as mock_setup_entry,
|
||||
):
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -308,7 +308,7 @@ async def test_discovered_by_discovery(hass: HomeAssistant) -> None:
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True) as mock_async_setup,
|
||||
patch(
|
||||
f"{MODULE}.async_setup_entry", return_value=True
|
||||
f"{MODULE}.async_setup_entry", return_value=None
|
||||
) as mock_async_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
@@ -340,7 +340,7 @@ async def test_discovered_by_dhcp(hass: HomeAssistant) -> None:
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True) as mock_async_setup,
|
||||
patch(
|
||||
f"{MODULE}.async_setup_entry", return_value=True
|
||||
f"{MODULE}.async_setup_entry", return_value=None
|
||||
) as mock_async_setup_entry,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
@@ -409,7 +409,7 @@ async def test_discovered_by_dhcp_or_discovery_adds_missing_unique_id(
|
||||
_patch_discovery(),
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True) as mock_setup,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=True) as mock_setup_entry,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=None) as mock_setup_entry,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": source}, data=data
|
||||
@@ -444,7 +444,7 @@ async def test_discovered_by_dhcp_or_discovery_existing_unique_id_does_not_reloa
|
||||
_patch_discovery(),
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True) as mock_setup,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=True) as mock_setup_entry,
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=None) as mock_setup_entry,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": source}, data=data
|
||||
@@ -488,7 +488,7 @@ async def test_pick_device_replaces_ignored_device(hass: HomeAssistant) -> None:
|
||||
_patch_discovery(),
|
||||
_patch_status(MOCK_ASYNC_GET_STATUS_INACTIVE),
|
||||
patch(f"{MODULE}.async_setup", return_value=True),
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=True),
|
||||
patch(f"{MODULE}.async_setup_entry", return_value=None),
|
||||
):
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result2["flow_id"],
|
||||
|
||||
@@ -26,7 +26,7 @@ def mock_setup_entry() -> Generator[None]:
|
||||
"""Prevent the integration from setting up after the flow."""
|
||||
with patch(
|
||||
"homeassistant.components.steamvr_base_station.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ def mock_v1_config_entry() -> MockConfigEntry:
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch(
|
||||
"homeassistant.components.stookwijzer.async_setup_entry", return_value=True
|
||||
"homeassistant.components.stookwijzer.async_setup_entry", return_value=None
|
||||
) as mock_setup:
|
||||
yield mock_setup
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from homeassistant.const import CONF_API_KEY
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.streamlabswater.async_setup_entry", return_value=True
|
||||
"homeassistant.components.streamlabswater.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
def mock_setup_entry(recorder_mock: Recorder) -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.suez_water.async_setup_entry", return_value=True
|
||||
"homeassistant.components.suez_water.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.sun.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
||||
@@ -325,6 +325,6 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sunricher_dali.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
@@ -28,7 +28,7 @@ USER_ID = "281092"
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.sunsynk.async_setup_entry", return_value=True
|
||||
"homeassistant.components.sunsynk.async_setup_entry", return_value=None
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def _patch_success() -> Generator[None]:
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.surepetcare.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
),
|
||||
):
|
||||
yield
|
||||
@@ -46,7 +46,7 @@ async def test_form(hass: HomeAssistant, surepetcare: NonCallableMagicMock) -> N
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.surepetcare.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
@@ -178,7 +178,7 @@ async def test_flow_entry_already_exists(
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.surepetcare.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
||||
@@ -56,6 +56,6 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.swiss_public_transport.async_setup_entry",
|
||||
return_value=True,
|
||||
return_value=None,
|
||||
) as mock_setup_entry:
|
||||
yield mock_setup_entry
|
||||
|
||||
Reference in New Issue
Block a user