Google Sheets: small cleanup (#83685)
* Remove duplicate object key in strings.json
* Remove async_entry_has_scopes check
This is not needed. This was copied from google calendar integration
where it was needed to reauth when the scope changed.
* Remove unused constant in application_credentials
* Move constant to the file used
* fix warning use-implicit-booleaness-not-len
* Remove not accessed parameters
* Revert "Remove async_entry_has_scopes check"
This reverts commit 63e24f84cc
.
This commit is contained in:
parent
e53758c1bb
commit
2cfdae0c45
5 changed files with 3 additions and 16 deletions
|
@ -21,9 +21,10 @@ from homeassistant.helpers.config_entry_oauth2_flow import (
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.selector import ConfigEntrySelector
|
||||
|
||||
from .const import DATA_CONFIG_ENTRY, DEFAULT_ACCESS, DOMAIN
|
||||
from .const import DEFAULT_ACCESS, DOMAIN
|
||||
|
||||
DATA = "data"
|
||||
DATA_CONFIG_ENTRY = "config_entry"
|
||||
WORKSHEET = "worksheet"
|
||||
|
||||
SERVICE_APPEND_SHEET = "append_sheet"
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
"""application_credentials platform for Google Sheets."""
|
||||
|
||||
import oauth2client
|
||||
|
||||
from homeassistant.components.application_credentials import AuthorizationServer
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
AUTHORIZATION_SERVER = AuthorizationServer(
|
||||
oauth2client.GOOGLE_AUTH_URI, oauth2client.GOOGLE_TOKEN_URI
|
||||
)
|
||||
|
||||
|
||||
async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
|
||||
"""Return authorization server."""
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
"""Constants for Google Sheets integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Final
|
||||
|
||||
DOMAIN = "google_sheets"
|
||||
|
||||
DATA_CONFIG_ENTRY: Final = "config_entry"
|
||||
DEFAULT_NAME = "Google Sheets"
|
||||
DEFAULT_ACCESS = "https://www.googleapis.com/auth/drive.file"
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
"pick_implementation": {
|
||||
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]"
|
||||
},
|
||||
"reauth_confirm": {
|
||||
"title": "[%key:common::config_flow::title::reauth%]",
|
||||
"description": "The Google Sheets integration needs to re-authenticate your account"
|
||||
},
|
||||
"auth": {
|
||||
"title": "Link Google Account"
|
||||
},
|
||||
|
|
|
@ -92,7 +92,7 @@ async def test_setup_success(
|
|||
|
||||
assert not hass.data.get(DOMAIN)
|
||||
assert entries[0].state is ConfigEntryState.NOT_LOADED
|
||||
assert not len(hass.services.async_services().get(DOMAIN, {}))
|
||||
assert not hass.services.async_services().get(DOMAIN, {})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -125,7 +125,6 @@ async def test_missing_required_scopes_requires_reauth(
|
|||
async def test_expired_token_refresh_success(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: ComponentSetup,
|
||||
scopes: list[str],
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test expired token is refreshed."""
|
||||
|
@ -168,7 +167,6 @@ async def test_expired_token_refresh_success(
|
|||
async def test_expired_token_refresh_failure(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: ComponentSetup,
|
||||
scopes: list[str],
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
status: http.HTTPStatus,
|
||||
expected_state: ConfigEntryState,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue