mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix AsusWRT wrong api call (#47522)
This commit is contained in:
parent
f9e33a4a0d
commit
32476a3fed
@ -46,7 +46,7 @@ homeassistant/components/arcam_fmj/* @elupus
|
|||||||
homeassistant/components/arduino/* @fabaff
|
homeassistant/components/arduino/* @fabaff
|
||||||
homeassistant/components/arest/* @fabaff
|
homeassistant/components/arest/* @fabaff
|
||||||
homeassistant/components/arris_tg2492lg/* @vanbalken
|
homeassistant/components/arris_tg2492lg/* @vanbalken
|
||||||
homeassistant/components/asuswrt/* @kennedyshead
|
homeassistant/components/asuswrt/* @kennedyshead @ollo69
|
||||||
homeassistant/components/atag/* @MatsNL
|
homeassistant/components/atag/* @MatsNL
|
||||||
homeassistant/components/aten_pe/* @mtdcr
|
homeassistant/components/aten_pe/* @mtdcr
|
||||||
homeassistant/components/atome/* @baqs
|
homeassistant/components/atome/* @baqs
|
||||||
|
@ -127,7 +127,7 @@ class AsusWrtFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
conf_protocol = user_input[CONF_PROTOCOL]
|
conf_protocol = user_input[CONF_PROTOCOL]
|
||||||
if conf_protocol == PROTOCOL_TELNET:
|
if conf_protocol == PROTOCOL_TELNET:
|
||||||
await api.connection.disconnect()
|
api.connection.disconnect()
|
||||||
return RESULT_SUCCESS
|
return RESULT_SUCCESS
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/asuswrt",
|
"documentation": "https://www.home-assistant.io/integrations/asuswrt",
|
||||||
"requirements": ["aioasuswrt==1.3.1"],
|
"requirements": ["aioasuswrt==1.3.1"],
|
||||||
"codeowners": ["@kennedyshead"]
|
"codeowners": ["@kennedyshead", "@ollo69"]
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ class AsusWrtRouter:
|
|||||||
"""Close the connection."""
|
"""Close the connection."""
|
||||||
if self._api is not None:
|
if self._api is not None:
|
||||||
if self._protocol == PROTOCOL_TELNET:
|
if self._protocol == PROTOCOL_TELNET:
|
||||||
await self._api.connection.disconnect()
|
self._api.connection.disconnect()
|
||||||
self._api = None
|
self._api = None
|
||||||
|
|
||||||
for func in self._on_close:
|
for func in self._on_close:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Tests for the AsusWrt config flow."""
|
"""Tests for the AsusWrt config flow."""
|
||||||
from socket import gaierror
|
from socket import gaierror
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def mock_controller_connect():
|
|||||||
with patch("homeassistant.components.asuswrt.router.AsusWrt") as service_mock:
|
with patch("homeassistant.components.asuswrt.router.AsusWrt") as service_mock:
|
||||||
service_mock.return_value.connection.async_connect = AsyncMock()
|
service_mock.return_value.connection.async_connect = AsyncMock()
|
||||||
service_mock.return_value.is_connected = True
|
service_mock.return_value.is_connected = True
|
||||||
service_mock.return_value.connection.disconnect = AsyncMock()
|
service_mock.return_value.connection.disconnect = Mock()
|
||||||
yield service_mock
|
yield service_mock
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Tests for the AsusWrt sensor."""
|
"""Tests for the AsusWrt sensor."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
|
||||||
from aioasuswrt.asuswrt import Device
|
from aioasuswrt.asuswrt import Device
|
||||||
import pytest
|
import pytest
|
||||||
@ -49,7 +49,7 @@ def mock_controller_connect():
|
|||||||
with patch("homeassistant.components.asuswrt.router.AsusWrt") as service_mock:
|
with patch("homeassistant.components.asuswrt.router.AsusWrt") as service_mock:
|
||||||
service_mock.return_value.connection.async_connect = AsyncMock()
|
service_mock.return_value.connection.async_connect = AsyncMock()
|
||||||
service_mock.return_value.is_connected = True
|
service_mock.return_value.is_connected = True
|
||||||
service_mock.return_value.connection.disconnect = AsyncMock()
|
service_mock.return_value.connection.disconnect = Mock()
|
||||||
service_mock.return_value.async_get_connected_devices = AsyncMock(
|
service_mock.return_value.async_get_connected_devices = AsyncMock(
|
||||||
return_value=MOCK_DEVICES
|
return_value=MOCK_DEVICES
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user