Remove oauth2client dependency in Google Assistant SDK (#85785)
Remove import oauth2client, inline 2 constantspull/85801/head
parent
28bea53afe
commit
8e26c048a7
|
@ -1,6 +1,4 @@
|
|||
"""application_credentials platform for Google Assistant SDK."""
|
||||
import oauth2client
|
||||
|
||||
from homeassistant.components.application_credentials import AuthorizationServer
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
@ -8,8 +6,8 @@ from homeassistant.core import HomeAssistant
|
|||
async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
|
||||
"""Return authorization server."""
|
||||
return AuthorizationServer(
|
||||
oauth2client.GOOGLE_AUTH_URI,
|
||||
oauth2client.GOOGLE_TOKEN_URI,
|
||||
"https://accounts.google.com/o/oauth2/v2/auth",
|
||||
"https://oauth2.googleapis.com/token",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Test the Google Assistant SDK config flow."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import oauth2client
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.google_assistant_sdk.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -12,6 +10,8 @@ from .conftest import CLIENT_ID, ComponentSetup
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
GOOGLE_AUTH_URI = "https://accounts.google.com/o/oauth2/v2/auth"
|
||||
GOOGLE_TOKEN_URI = "https://oauth2.googleapis.com/token"
|
||||
TITLE = "Google Assistant SDK"
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ async def test_full_flow(
|
|||
)
|
||||
|
||||
assert result["url"] == (
|
||||
f"{oauth2client.GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
f"{GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
"&redirect_uri=https://example.com/auth/external/callback"
|
||||
f"&state={state}&scope=https://www.googleapis.com/auth/assistant-sdk-prototype"
|
||||
"&access_type=offline&prompt=consent"
|
||||
|
@ -47,7 +47,7 @@ async def test_full_flow(
|
|||
assert resp.headers["content-type"] == "text/html; charset=utf-8"
|
||||
|
||||
aioclient_mock.post(
|
||||
oauth2client.GOOGLE_TOKEN_URI,
|
||||
GOOGLE_TOKEN_URI,
|
||||
json={
|
||||
"refresh_token": "mock-refresh-token",
|
||||
"access_token": "mock-access-token",
|
||||
|
@ -112,7 +112,7 @@ async def test_reauth(
|
|||
},
|
||||
)
|
||||
assert result["url"] == (
|
||||
f"{oauth2client.GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
f"{GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
"&redirect_uri=https://example.com/auth/external/callback"
|
||||
f"&state={state}&scope=https://www.googleapis.com/auth/assistant-sdk-prototype"
|
||||
"&access_type=offline&prompt=consent"
|
||||
|
@ -123,7 +123,7 @@ async def test_reauth(
|
|||
assert resp.headers["content-type"] == "text/html; charset=utf-8"
|
||||
|
||||
aioclient_mock.post(
|
||||
oauth2client.GOOGLE_TOKEN_URI,
|
||||
GOOGLE_TOKEN_URI,
|
||||
json={
|
||||
"refresh_token": "mock-refresh-token",
|
||||
"access_token": "updated-access-token",
|
||||
|
@ -181,7 +181,7 @@ async def test_single_instance_allowed(
|
|||
)
|
||||
|
||||
assert result["url"] == (
|
||||
f"{oauth2client.GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
f"{GOOGLE_AUTH_URI}?response_type=code&client_id={CLIENT_ID}"
|
||||
"&redirect_uri=https://example.com/auth/external/callback"
|
||||
f"&state={state}&scope=https://www.googleapis.com/auth/assistant-sdk-prototype"
|
||||
"&access_type=offline&prompt=consent"
|
||||
|
@ -193,7 +193,7 @@ async def test_single_instance_allowed(
|
|||
assert resp.headers["content-type"] == "text/html; charset=utf-8"
|
||||
|
||||
aioclient_mock.post(
|
||||
oauth2client.GOOGLE_TOKEN_URI,
|
||||
GOOGLE_TOKEN_URI,
|
||||
json={
|
||||
"refresh_token": "mock-refresh-token",
|
||||
"access_token": "mock-access-token",
|
||||
|
|
Loading…
Reference in New Issue