mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Bump aiounifi to v58 (#99103)
This commit is contained in:
parent
a81e6d5811
commit
45efe29262
@ -10,6 +10,7 @@ from typing import Any
|
|||||||
from aiohttp import CookieJar
|
from aiohttp import CookieJar
|
||||||
import aiounifi
|
import aiounifi
|
||||||
from aiounifi.interfaces.api_handlers import ItemEvent
|
from aiounifi.interfaces.api_handlers import ItemEvent
|
||||||
|
from aiounifi.models.configuration import Configuration
|
||||||
from aiounifi.websocket import WebsocketState
|
from aiounifi.websocket import WebsocketState
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -409,18 +410,19 @@ async def get_unifi_controller(
|
|||||||
)
|
)
|
||||||
|
|
||||||
controller = aiounifi.Controller(
|
controller = aiounifi.Controller(
|
||||||
|
Configuration(
|
||||||
|
session,
|
||||||
host=config[CONF_HOST],
|
host=config[CONF_HOST],
|
||||||
username=config[CONF_USERNAME],
|
username=config[CONF_USERNAME],
|
||||||
password=config[CONF_PASSWORD],
|
password=config[CONF_PASSWORD],
|
||||||
port=config[CONF_PORT],
|
port=config[CONF_PORT],
|
||||||
site=config[CONF_SITE_ID],
|
site=config[CONF_SITE_ID],
|
||||||
websession=session,
|
|
||||||
ssl_context=ssl_context,
|
ssl_context=ssl_context,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
await controller.check_unifi_os()
|
|
||||||
await controller.login()
|
await controller.login()
|
||||||
return controller
|
return controller
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["aiounifi"],
|
"loggers": ["aiounifi"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["aiounifi==55"],
|
"requirements": ["aiounifi==58"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"manufacturer": "Ubiquiti Networks",
|
"manufacturer": "Ubiquiti Networks",
|
||||||
|
@ -360,7 +360,7 @@ aiosyncthing==0.5.1
|
|||||||
aiotractive==0.5.5
|
aiotractive==0.5.5
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==55
|
aiounifi==58
|
||||||
|
|
||||||
# homeassistant.components.vlc_telnet
|
# homeassistant.components.vlc_telnet
|
||||||
aiovlc==0.1.0
|
aiovlc==0.1.0
|
||||||
|
@ -335,7 +335,7 @@ aiosyncthing==0.5.1
|
|||||||
aiotractive==0.5.5
|
aiotractive==0.5.5
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==55
|
aiounifi==58
|
||||||
|
|
||||||
# homeassistant.components.vlc_telnet
|
# homeassistant.components.vlc_telnet
|
||||||
aiovlc==0.1.0
|
aiovlc==0.1.0
|
||||||
|
@ -395,9 +395,7 @@ async def test_reconnect_mechanism(
|
|||||||
await setup_unifi_integration(hass, aioclient_mock)
|
await setup_unifi_integration(hass, aioclient_mock)
|
||||||
|
|
||||||
aioclient_mock.clear_requests()
|
aioclient_mock.clear_requests()
|
||||||
aioclient_mock.post(
|
aioclient_mock.get(f"https://{DEFAULT_HOST}:1234/", status=HTTPStatus.BAD_GATEWAY)
|
||||||
f"https://{DEFAULT_HOST}:1234/api/login", status=HTTPStatus.BAD_GATEWAY
|
|
||||||
)
|
|
||||||
|
|
||||||
mock_unifi_websocket(state=WebsocketState.DISCONNECTED)
|
mock_unifi_websocket(state=WebsocketState.DISCONNECTED)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
@ -448,9 +446,7 @@ async def test_reconnect_mechanism_exceptions(
|
|||||||
|
|
||||||
async def test_get_unifi_controller(hass: HomeAssistant) -> None:
|
async def test_get_unifi_controller(hass: HomeAssistant) -> None:
|
||||||
"""Successful call."""
|
"""Successful call."""
|
||||||
with patch("aiounifi.Controller.check_unifi_os", return_value=True), patch(
|
with patch("aiounifi.Controller.login", return_value=True):
|
||||||
"aiounifi.Controller.login", return_value=True
|
|
||||||
):
|
|
||||||
assert await get_unifi_controller(hass, ENTRY_CONFIG)
|
assert await get_unifi_controller(hass, ENTRY_CONFIG)
|
||||||
|
|
||||||
|
|
||||||
@ -458,9 +454,7 @@ async def test_get_unifi_controller_verify_ssl_false(hass: HomeAssistant) -> Non
|
|||||||
"""Successful call with verify ssl set to false."""
|
"""Successful call with verify ssl set to false."""
|
||||||
controller_data = dict(ENTRY_CONFIG)
|
controller_data = dict(ENTRY_CONFIG)
|
||||||
controller_data[CONF_VERIFY_SSL] = False
|
controller_data[CONF_VERIFY_SSL] = False
|
||||||
with patch("aiounifi.Controller.check_unifi_os", return_value=True), patch(
|
with patch("aiounifi.Controller.login", return_value=True):
|
||||||
"aiounifi.Controller.login", return_value=True
|
|
||||||
):
|
|
||||||
assert await get_unifi_controller(hass, controller_data)
|
assert await get_unifi_controller(hass, controller_data)
|
||||||
|
|
||||||
|
|
||||||
@ -481,7 +475,7 @@ async def test_get_unifi_controller_fails_to_connect(
|
|||||||
hass: HomeAssistant, side_effect, raised_exception
|
hass: HomeAssistant, side_effect, raised_exception
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Check that get_unifi_controller can handle controller being unavailable."""
|
"""Check that get_unifi_controller can handle controller being unavailable."""
|
||||||
with patch("aiounifi.Controller.check_unifi_os", return_value=True), patch(
|
with patch("aiounifi.Controller.login", side_effect=side_effect), pytest.raises(
|
||||||
"aiounifi.Controller.login", side_effect=side_effect
|
raised_exception
|
||||||
), pytest.raises(raised_exception):
|
):
|
||||||
await get_unifi_controller(hass, ENTRY_CONFIG)
|
await get_unifi_controller(hass, ENTRY_CONFIG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user