From 9e7a08629cae3cb1f67b9609e8adfccb6d13b0af Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 15:12:11 +0000 Subject: [PATCH] chore: use gapic-generator-python 0.53.4 (#103) - [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: https://github.com/googleapis/googleapis/commit/83d81b0c8fc22291a13398d6d77f02dc97a5b6f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9 --- .../services/tables_service/async_client.py | 76 ++++++------ .../services/tables_service/client.py | 26 ++-- .../tables_service/transports/base.py | 35 +----- .../tables_service/transports/grpc_asyncio.py | 1 - packages/google-area120-tables/setup.py | 3 +- .../testing/constraints-3.6.txt | 3 +- .../tables_v1alpha1/test_tables_service.py | 112 ++---------------- 7 files changed, 65 insertions(+), 191 deletions(-) diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py index 547f6eb71b71..87dbe71f9282 100644 --- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py +++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.area120.tables_v1alpha1.services.tables_service import pagers from google.area120.tables_v1alpha1.types import tables from google.protobuf import field_mask_pb2 # type: ignore @@ -182,17 +184,17 @@ def __init__( async def get_table( self, - request: tables.GetTableRequest = None, + request: Union[tables.GetTableRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Table: r"""Gets a table. Returns NOT_FOUND if the table does not exist. Args: - request (:class:`google.area120.tables_v1alpha1.types.GetTableRequest`): + request (Union[google.area120.tables_v1alpha1.types.GetTableRequest, dict]): The request object. Request message for TablesService.GetTable. name (:class:`str`): @@ -251,16 +253,16 @@ async def get_table( async def list_tables( self, - request: tables.ListTablesRequest = None, + request: Union[tables.ListTablesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTablesAsyncPager: r"""Lists tables for the user. Args: - request (:class:`google.area120.tables_v1alpha1.types.ListTablesRequest`): + request (Union[google.area120.tables_v1alpha1.types.ListTablesRequest, dict]): The request object. Request message for TablesService.ListTables. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -303,10 +305,10 @@ async def list_tables( async def get_workspace( self, - request: tables.GetWorkspaceRequest = None, + request: Union[tables.GetWorkspaceRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Workspace: @@ -314,7 +316,7 @@ async def get_workspace( exist. Args: - request (:class:`google.area120.tables_v1alpha1.types.GetWorkspaceRequest`): + request (Union[google.area120.tables_v1alpha1.types.GetWorkspaceRequest, dict]): The request object. Request message for TablesService.GetWorkspace. name (:class:`str`): @@ -374,16 +376,16 @@ async def get_workspace( async def list_workspaces( self, - request: tables.ListWorkspacesRequest = None, + request: Union[tables.ListWorkspacesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkspacesAsyncPager: r"""Lists workspaces for the user. Args: - request (:class:`google.area120.tables_v1alpha1.types.ListWorkspacesRequest`): + request (Union[google.area120.tables_v1alpha1.types.ListWorkspacesRequest, dict]): The request object. Request message for TablesService.ListWorkspaces. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -426,10 +428,10 @@ async def list_workspaces( async def get_row( self, - request: tables.GetRowRequest = None, + request: Union[tables.GetRowRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: @@ -437,7 +439,7 @@ async def get_row( table. Args: - request (:class:`google.area120.tables_v1alpha1.types.GetRowRequest`): + request (Union[google.area120.tables_v1alpha1.types.GetRowRequest, dict]): The request object. Request message for TablesService.GetRow. name (:class:`str`): @@ -497,10 +499,10 @@ async def get_row( async def list_rows( self, - request: tables.ListRowsRequest = None, + request: Union[tables.ListRowsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListRowsAsyncPager: @@ -508,7 +510,7 @@ async def list_rows( exist. Args: - request (:class:`google.area120.tables_v1alpha1.types.ListRowsRequest`): + request (Union[google.area120.tables_v1alpha1.types.ListRowsRequest, dict]): The request object. Request message for TablesService.ListRows. parent (:class:`str`): @@ -578,18 +580,18 @@ async def list_rows( async def create_row( self, - request: tables.CreateRowRequest = None, + request: Union[tables.CreateRowRequest, dict] = None, *, parent: str = None, row: tables.Row = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: r"""Creates a row. Args: - request (:class:`google.area120.tables_v1alpha1.types.CreateRowRequest`): + request (Union[google.area120.tables_v1alpha1.types.CreateRowRequest, dict]): The request object. Request message for TablesService.CreateRow. parent (:class:`str`): @@ -656,16 +658,16 @@ async def create_row( async def batch_create_rows( self, - request: tables.BatchCreateRowsRequest = None, + request: Union[tables.BatchCreateRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.BatchCreateRowsResponse: r"""Creates multiple rows. Args: - request (:class:`google.area120.tables_v1alpha1.types.BatchCreateRowsRequest`): + request (Union[google.area120.tables_v1alpha1.types.BatchCreateRowsRequest, dict]): The request object. Request message for TablesService.BatchCreateRows. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -705,18 +707,18 @@ async def batch_create_rows( async def update_row( self, - request: tables.UpdateRowRequest = None, + request: Union[tables.UpdateRowRequest, dict] = None, *, row: tables.Row = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: r"""Updates a row. Args: - request (:class:`google.area120.tables_v1alpha1.types.UpdateRowRequest`): + request (Union[google.area120.tables_v1alpha1.types.UpdateRowRequest, dict]): The request object. Request message for TablesService.UpdateRow. row (:class:`google.area120.tables_v1alpha1.types.Row`): @@ -780,16 +782,16 @@ async def update_row( async def batch_update_rows( self, - request: tables.BatchUpdateRowsRequest = None, + request: Union[tables.BatchUpdateRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.BatchUpdateRowsResponse: r"""Updates multiple rows. Args: - request (:class:`google.area120.tables_v1alpha1.types.BatchUpdateRowsRequest`): + request (Union[google.area120.tables_v1alpha1.types.BatchUpdateRowsRequest, dict]): The request object. Request message for TablesService.BatchUpdateRows. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -829,17 +831,17 @@ async def batch_update_rows( async def delete_row( self, - request: tables.DeleteRowRequest = None, + request: Union[tables.DeleteRowRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a row. Args: - request (:class:`google.area120.tables_v1alpha1.types.DeleteRowRequest`): + request (Union[google.area120.tables_v1alpha1.types.DeleteRowRequest, dict]): The request object. Request message for TablesService.DeleteRow name (:class:`str`): @@ -894,16 +896,16 @@ async def delete_row( async def batch_delete_rows( self, - request: tables.BatchDeleteRowsRequest = None, + request: Union[tables.BatchDeleteRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes multiple rows. Args: - request (:class:`google.area120.tables_v1alpha1.types.BatchDeleteRowsRequest`): + request (Union[google.area120.tables_v1alpha1.types.BatchDeleteRowsRequest, dict]): The request object. Request message for TablesService.BatchDeleteRows retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py index d7630eee4842..b5face23521b 100644 --- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py +++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.area120.tables_v1alpha1.services.tables_service import pagers from google.area120.tables_v1alpha1.types import tables from google.protobuf import field_mask_pb2 # type: ignore @@ -382,7 +384,7 @@ def get_table( request: Union[tables.GetTableRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Table: @@ -450,7 +452,7 @@ def list_tables( self, request: Union[tables.ListTablesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListTablesPager: @@ -504,7 +506,7 @@ def get_workspace( request: Union[tables.GetWorkspaceRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Workspace: @@ -574,7 +576,7 @@ def list_workspaces( self, request: Union[tables.ListWorkspacesRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkspacesPager: @@ -628,7 +630,7 @@ def get_row( request: Union[tables.GetRowRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: @@ -699,7 +701,7 @@ def list_rows( request: Union[tables.ListRowsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListRowsPager: @@ -781,7 +783,7 @@ def create_row( *, parent: str = None, row: tables.Row = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: @@ -857,7 +859,7 @@ def batch_create_rows( self, request: Union[tables.BatchCreateRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.BatchCreateRowsResponse: @@ -909,7 +911,7 @@ def update_row( *, row: tables.Row = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.Row: @@ -982,7 +984,7 @@ def batch_update_rows( self, request: Union[tables.BatchUpdateRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> tables.BatchUpdateRowsResponse: @@ -1033,7 +1035,7 @@ def delete_row( request: Union[tables.DeleteRowRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1097,7 +1099,7 @@ def batch_delete_rows( self, request: Union[tables.BatchDeleteRowsRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py index 389f5232270f..b83031660584 100644 --- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py +++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -36,15 +35,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class TablesServiceTransport(abc.ABC): """Abstract transport class for TablesService.""" @@ -101,7 +91,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -134,29 +124,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py index dcb67a9d9208..c14288b52b00 100644 --- a/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py +++ b/packages/google-area120-tables/google/area120/tables_v1alpha1/services/tables_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/packages/google-area120-tables/setup.py b/packages/google-area120-tables/setup.py index a537b3a39f25..452e38e49306 100644 --- a/packages/google-area120-tables/setup.py +++ b/packages/google-area120-tables/setup.py @@ -48,9 +48,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.26.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 1.4.0", - "packaging >= 14.3", ), python_requires=">=3.6", classifiers=[ diff --git a/packages/google-area120-tables/testing/constraints-3.6.txt b/packages/google-area120-tables/testing/constraints-3.6.txt index 9fef823ef305..6b451bc37e2f 100644 --- a/packages/google-area120-tables/testing/constraints-3.6.txt +++ b/packages/google-area120-tables/testing/constraints-3.6.txt @@ -5,6 +5,5 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.26.0 +google-api-core==1.28.0 proto-plus==1.4.0 -packaging==14.3 diff --git a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py index 134f4959819c..4044f141b12d 100644 --- a/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py +++ b/packages/google-area120-tables/tests/unit/gapic/tables_v1alpha1/test_tables_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -36,9 +35,6 @@ from google.area120.tables_v1alpha1.services.tables_service import TablesServiceClient from google.area120.tables_v1alpha1.services.tables_service import pagers from google.area120.tables_v1alpha1.services.tables_service import transports -from google.area120.tables_v1alpha1.services.tables_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.area120.tables_v1alpha1.types import tables from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError @@ -48,20 +44,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -218,7 +200,7 @@ def test_tables_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -235,7 +217,7 @@ def test_tables_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -252,7 +234,7 @@ def test_tables_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -281,7 +263,7 @@ def test_tables_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -340,7 +322,7 @@ def test_tables_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -382,7 +364,7 @@ def test_tables_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -404,7 +386,7 @@ def test_tables_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -435,7 +417,7 @@ def test_tables_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -466,7 +448,7 @@ def test_tables_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -2949,7 +2931,6 @@ def test_tables_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_tables_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -2977,33 +2958,6 @@ def test_tables_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_tables_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.area120.tables_v1alpha1.services.tables_service.transports.TablesServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.TablesServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=( - "https://www.googleapis.com/auth/drive", - "https://www.googleapis.com/auth/drive.file", - "https://www.googleapis.com/auth/drive.readonly", - "https://www.googleapis.com/auth/spreadsheets", - "https://www.googleapis.com/auth/spreadsheets.readonly", - "https://www.googleapis.com/auth/tables", - ), - quota_project_id="octopus", - ) - - def test_tables_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -3015,7 +2969,6 @@ def test_tables_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_tables_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -3035,25 +2988,6 @@ def test_tables_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_tables_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - TablesServiceClient() - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/drive", - "https://www.googleapis.com/auth/drive.file", - "https://www.googleapis.com/auth/drive.readonly", - "https://www.googleapis.com/auth/spreadsheets", - "https://www.googleapis.com/auth/spreadsheets.readonly", - "https://www.googleapis.com/auth/tables", - ), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -3061,7 +2995,6 @@ def test_tables_service_auth_adc_old_google_auth(): transports.TablesServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_tables_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -3082,33 +3015,6 @@ def test_tables_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.TablesServiceGrpcTransport, - transports.TablesServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_tables_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/drive", - "https://www.googleapis.com/auth/drive.file", - "https://www.googleapis.com/auth/drive.readonly", - "https://www.googleapis.com/auth/spreadsheets", - "https://www.googleapis.com/auth/spreadsheets.readonly", - "https://www.googleapis.com/auth/tables", - ), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [