mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 04:08:19 -04:00
Bump python-izone to 2.0.1 (#191723)
This commit is contained in:
@@ -425,12 +425,6 @@ class IZoneConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
suggested_values={CONF_HOST: host},
|
||||
)
|
||||
|
||||
if endpoint is None:
|
||||
return self._async_show_manual_host_form(
|
||||
errors={"base": "cannot_connect"},
|
||||
suggested_values={CONF_HOST: host},
|
||||
)
|
||||
|
||||
if endpoint.uid in izone_discovery.yaml_excluded_uids(self.hass):
|
||||
return self._async_show_manual_host_form(
|
||||
errors={"base": "no_devices_found"},
|
||||
|
||||
@@ -236,7 +236,7 @@ async def async_discover_endpoint(
|
||||
|
||||
async def async_discover_by_host(
|
||||
hass: HomeAssistant, host: str
|
||||
) -> pizone.ControllerEndpoint | None:
|
||||
) -> pizone.ControllerEndpoint:
|
||||
"""HTTP-probe a controller at *host* for config-flow validation.
|
||||
|
||||
Starts shared discovery if needed.
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["pizone"],
|
||||
"quality_scale": "silver",
|
||||
"requirements": ["python-izone==2.0.0"]
|
||||
"requirements": ["python-izone==2.0.1"]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -2821,7 +2821,7 @@ python-hotspring==4.0.2
|
||||
python-hpilo==4.4.3
|
||||
|
||||
# homeassistant.components.izone
|
||||
python-izone==2.0.0
|
||||
python-izone==2.0.1
|
||||
|
||||
# homeassistant.components.joaoapps_join
|
||||
python-join-api==0.1.1
|
||||
|
||||
@@ -4,7 +4,14 @@ from collections.abc import AsyncGenerator, Generator, Iterable
|
||||
from contextlib import contextmanager
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
from pizone import Controller, ControllerEndpoint, DiscoveryService, Zone
|
||||
from pizone import (
|
||||
Controller,
|
||||
ControllerEndpoint,
|
||||
DiscoveryService,
|
||||
EndpointVerifyError,
|
||||
VerifyFailure,
|
||||
Zone,
|
||||
)
|
||||
import pytest
|
||||
from pytest_homeassistant.common import MockConfigEntry
|
||||
|
||||
@@ -225,10 +232,12 @@ def patch_discovered_controllers(
|
||||
async def _discover_one(hass: HomeAssistant, uid: str) -> ControllerEndpoint | None:
|
||||
return endpoints.get(uid)
|
||||
|
||||
async def _discover_by_host(
|
||||
hass: HomeAssistant, host: str
|
||||
) -> ControllerEndpoint | None:
|
||||
return next((ep for ep in endpoints.values() if ep.host == host), None)
|
||||
async def _discover_by_host(hass: HomeAssistant, host: str) -> ControllerEndpoint:
|
||||
if (
|
||||
endpoint := next((ep for ep in endpoints.values() if ep.host == host), None)
|
||||
) is None:
|
||||
raise EndpointVerifyError(host, VerifyFailure.NO_REPLY)
|
||||
return endpoint
|
||||
|
||||
mock_discover_all = AsyncMock(side_effect=_discover_all)
|
||||
mock_scan = AsyncMock(side_effect=_scan)
|
||||
|
||||
@@ -1679,27 +1679,15 @@ async def test_user_manual_host_empty_rejected_by_schema(hass: HomeAssistant) ->
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_entry_setup")
|
||||
@pytest.mark.parametrize(
|
||||
"lookup",
|
||||
[
|
||||
pytest.param(AsyncMock(return_value=None), id="no-endpoint"),
|
||||
pytest.param(
|
||||
AsyncMock(
|
||||
side_effect=pizone.EndpointVerifyError(
|
||||
"192.0.2.99", pizone.VerifyFailure.NO_REPLY
|
||||
)
|
||||
),
|
||||
id="verify-error",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_user_manual_host_unreachable(
|
||||
hass: HomeAssistant, lookup: AsyncMock
|
||||
) -> None:
|
||||
async def test_user_manual_host_unreachable(hass: HomeAssistant) -> None:
|
||||
"""Unreachable host redisplays the form with cannot_connect."""
|
||||
with patch(
|
||||
"homeassistant.components.izone.discovery.async_discover_by_host",
|
||||
new=lookup,
|
||||
new=AsyncMock(
|
||||
side_effect=pizone.EndpointVerifyError(
|
||||
"192.0.2.99", pizone.VerifyFailure.NO_REPLY
|
||||
)
|
||||
),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
|
||||
@@ -27,7 +27,6 @@ def _mock_pizone_service() -> Mock:
|
||||
service.close = AsyncMock()
|
||||
service.discover_all = AsyncMock(return_value=[])
|
||||
service.discover_by_uid = AsyncMock(return_value=None)
|
||||
service.discover_by_host = AsyncMock(return_value=None)
|
||||
return service
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user