mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Bump aiovodafone to 3.0.0 (#154751)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Vodafone Station integration."""
|
||||
|
||||
from aiohttp import ClientSession, CookieJar
|
||||
from aiovodafone.api import VodafoneStationCommonApi
|
||||
from aiovodafone.models import get_device_type
|
||||
|
||||
from homeassistant.const import CONF_HOST, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -42,7 +42,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: VodafoneConfigEntry) -
|
||||
session = ClientSession(cookie_jar=jar)
|
||||
|
||||
try:
|
||||
device_type, url = await VodafoneStationCommonApi.get_device_type(
|
||||
device_type, url = await get_device_type(
|
||||
entry.data[CONF_HOST],
|
||||
session,
|
||||
)
|
||||
@@ -54,7 +54,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: VodafoneConfigEntry) -
|
||||
new_data.update(
|
||||
{
|
||||
CONF_DEVICE_DETAILS: {
|
||||
DEVICE_TYPE: device_type,
|
||||
DEVICE_TYPE: device_type.value,
|
||||
DEVICE_URL: str(url),
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from aiovodafone import exceptions as aiovodafone_exceptions
|
||||
from aiovodafone.api import VodafoneStationCommonApi, init_api_class
|
||||
from aiovodafone.models import get_device_type, init_device_class
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_tracker import (
|
||||
@@ -54,12 +54,12 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
|
||||
|
||||
session = await async_client_session(hass)
|
||||
|
||||
device_type, url = await VodafoneStationCommonApi.get_device_type(
|
||||
device_type, url = await get_device_type(
|
||||
data[CONF_HOST],
|
||||
session,
|
||||
)
|
||||
|
||||
api = init_api_class(url, device_type, data, session)
|
||||
api = init_device_class(url, device_type, data, session)
|
||||
|
||||
try:
|
||||
await api.login()
|
||||
@@ -69,7 +69,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
|
||||
return {
|
||||
"title": data[CONF_HOST],
|
||||
CONF_DEVICE_DETAILS: {
|
||||
DEVICE_TYPE: device_type,
|
||||
DEVICE_TYPE: device_type.value,
|
||||
DEVICE_URL: str(url),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ from typing import Any, cast
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from aiovodafone import exceptions
|
||||
from aiovodafone.api import VodafoneStationDevice, init_api_class
|
||||
from aiovodafone.api import VodafoneStationDevice
|
||||
from aiovodafone.models import init_device_class
|
||||
from yarl import URL
|
||||
|
||||
from homeassistant.components.device_tracker import (
|
||||
@@ -70,7 +71,7 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
||||
|
||||
data = config_entry.data
|
||||
|
||||
self.api = init_api_class(
|
||||
self.api = init_device_class(
|
||||
URL(data[CONF_DEVICE_DETAILS][DEVICE_URL]),
|
||||
data[CONF_DEVICE_DETAILS][DEVICE_TYPE],
|
||||
data,
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["aiovodafone"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["aiovodafone==2.0.1"]
|
||||
"requirements": ["aiovodafone==3.0.0"]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -432,7 +432,7 @@ aiousbwatcher==1.1.1
|
||||
aiovlc==0.5.1
|
||||
|
||||
# homeassistant.components.vodafone_station
|
||||
aiovodafone==2.0.1
|
||||
aiovodafone==3.0.0
|
||||
|
||||
# homeassistant.components.waqi
|
||||
aiowaqi==3.1.0
|
||||
|
||||
Generated
+1
-1
@@ -414,7 +414,7 @@ aiousbwatcher==1.1.1
|
||||
aiovlc==0.5.1
|
||||
|
||||
# homeassistant.components.vodafone_station
|
||||
aiovodafone==2.0.1
|
||||
aiovodafone==3.0.0
|
||||
|
||||
# homeassistant.components.waqi
|
||||
aiowaqi==3.1.0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from aiovodafone.api import VodafoneStationCommonApi, VodafoneStationDevice
|
||||
from aiovodafone.api import VodafoneStationDevice
|
||||
import pytest
|
||||
from yarl import URL
|
||||
|
||||
@@ -49,16 +49,19 @@ def mock_vodafone_station_router() -> Generator[AsyncMock]:
|
||||
"""Mock a Vodafone Station router."""
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.vodafone_station.coordinator.init_api_class",
|
||||
"homeassistant.components.vodafone_station.coordinator.init_device_class",
|
||||
autospec=True,
|
||||
) as mock_router,
|
||||
patch(
|
||||
"homeassistant.components.vodafone_station.config_flow.init_api_class",
|
||||
"homeassistant.components.vodafone_station.config_flow.init_device_class",
|
||||
new=mock_router,
|
||||
),
|
||||
patch.object(
|
||||
VodafoneStationCommonApi,
|
||||
"get_device_type",
|
||||
patch(
|
||||
"homeassistant.components.vodafone_station.config_flow.get_device_type",
|
||||
new=AsyncMock(return_value=(TEST_TYPE, URL(TEST_URL))),
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.vodafone_station.get_device_type",
|
||||
new=AsyncMock(return_value=(TEST_TYPE, URL(TEST_URL))),
|
||||
),
|
||||
):
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Common stuff for Vodafone Station tests."""
|
||||
|
||||
from aiovodafone.models import DeviceType
|
||||
|
||||
DEVICE_1_HOST = "WifiDevice0"
|
||||
DEVICE_1_MAC = "xx:xx:xx:xx:xx:xx"
|
||||
DEVICE_2_HOST = "LanDevice1"
|
||||
@@ -7,6 +9,6 @@ DEVICE_2_MAC = "yy:yy:yy:yy:yy:yy"
|
||||
|
||||
TEST_HOST = "fake_host"
|
||||
TEST_PASSWORD = "fake_password"
|
||||
TEST_TYPE = "Sercomm"
|
||||
TEST_TYPE = DeviceType.SERCOMM
|
||||
TEST_URL = f"https://{TEST_HOST}"
|
||||
TEST_USERNAME = "fake_username"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from aiovodafone import (
|
||||
from aiovodafone.exceptions import (
|
||||
AlreadyLogged,
|
||||
CannotAuthenticate,
|
||||
CannotConnect,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import logging
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from aiovodafone import VodafoneStationDevice
|
||||
from aiovodafone.api import VodafoneStationDevice
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiovodafone import CannotAuthenticate
|
||||
from aiovodafone.exceptions import AlreadyLogged, CannotConnect
|
||||
from aiovodafone.exceptions import AlreadyLogged, CannotAuthenticate, CannotConnect
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
Reference in New Issue
Block a user