Bump python-google-nest-sdm to 7.0.0 (#134016)

Update python-google-nest-sdm to 7.0.0
This commit is contained in:
Allen Porter
2024-12-25 21:03:44 -08:00
committed by GitHub
parent 299250ebec
commit c75222e63c
17 changed files with 329 additions and 377 deletions

View File

@@ -9,16 +9,16 @@ The tests below exercise both cases during integration setup.
"""
import time
from unittest.mock import patch
from unittest.mock import AsyncMock, Mock, patch
from google_nest_sdm.google_nest_subscriber import GoogleNestSubscriber
from google.oauth2.credentials import Credentials
import pytest
from homeassistant.components.nest.const import API_URL, OAUTH2_TOKEN, SDM_SCOPES
from homeassistant.core import HomeAssistant
from homeassistant.util import dt as dt_util
from .common import CLIENT_ID, CLIENT_SECRET, PROJECT_ID, FakeSubscriber, PlatformSetup
from .common import CLIENT_ID, CLIENT_SECRET, PROJECT_ID, PlatformSetup
from .conftest import FAKE_REFRESH_TOKEN, FAKE_TOKEN
from tests.test_util.aiohttp import AiohttpClientMocker
@@ -27,7 +27,7 @@ FAKE_UPDATED_TOKEN = "fake-updated-token"
@pytest.fixture
def subscriber() -> FakeSubscriber | None:
def subscriber() -> Mock | None:
"""Disable default subscriber since tests use their own patch."""
return None
@@ -54,16 +54,16 @@ async def test_auth(
# Prepare to capture credentials for Subscriber
captured_creds = None
async def async_new_subscriber(
creds, subscription_name, event_loop, async_callback
) -> GoogleNestSubscriber | None:
def async_new_subscriber(
credentials: Credentials,
) -> Mock:
"""Capture credentials for tests."""
nonlocal captured_creds
captured_creds = creds
return None # GoogleNestSubscriber
captured_creds = credentials
return AsyncMock()
with patch(
"google_nest_sdm.google_nest_subscriber.DefaultSubscriberFactory.async_new_subscriber",
"google_nest_sdm.subscriber_client.pubsub_v1.SubscriberAsyncClient",
side_effect=async_new_subscriber,
) as new_subscriber_mock:
await setup_platform()
@@ -122,16 +122,16 @@ async def test_auth_expired_token(
# Prepare to capture credentials for Subscriber
captured_creds = None
async def async_new_subscriber(
creds, subscription_name, event_loop, async_callback
) -> GoogleNestSubscriber | None:
def async_new_subscriber(
credentials: Credentials,
) -> Mock:
"""Capture credentials for tests."""
nonlocal captured_creds
captured_creds = creds
return None # GoogleNestSubscriber
captured_creds = credentials
return AsyncMock()
with patch(
"google_nest_sdm.google_nest_subscriber.DefaultSubscriberFactory.async_new_subscriber",
"google_nest_sdm.subscriber_client.pubsub_v1.SubscriberAsyncClient",
side_effect=async_new_subscriber,
) as new_subscriber_mock:
await setup_platform()