diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ba7b2f7..cb89b2e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:3728d8fd14daa46a96d04ce61c6451a3ac864dc48fb71eecbb4411f4a95618d4 + digest: sha256:ec49167c606648a063d1222220b48119c912562849a0528f35bfb592a9f72737 diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg index 0ef4609..32dd42d 100644 --- a/.kokoro/docs/common.cfg +++ b/.kokoro/docs/common.cfg @@ -30,6 +30,7 @@ env_vars: { env_vars: { key: "V2_STAGING_BUCKET" + # Push google cloud library docs to the Cloud RAD bucket `docs-staging-v2` value: "docs-staging-v2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a0065a3..9f15823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +### [1.2.1](https://www.github.com/googleapis/python-shell/compare/v1.2.0...v1.2.1) (2021-11-01) + + +### Bug Fixes + +* **deps:** drop packaging dependency ([ff43aa0](https://www.github.com/googleapis/python-shell/commit/ff43aa0900e4fc626ab3243621f1ccc763878616)) +* **deps:** require google-api-core >= 1.28.0 ([ff43aa0](https://www.github.com/googleapis/python-shell/commit/ff43aa0900e4fc626ab3243621f1ccc763878616)) + + +### Documentation + +* list oneofs in docstring ([ff43aa0](https://www.github.com/googleapis/python-shell/commit/ff43aa0900e4fc626ab3243621f1ccc763878616)) + ## [1.2.0](https://www.github.com/googleapis/python-shell/compare/v1.1.0...v1.2.0) (2021-10-18) diff --git a/docs/index.rst b/docs/index.rst index 3d47fe6..98145ca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,12 +11,13 @@ API Reference shell_v1/services shell_v1/types + Changelog --------- For a list of all ``google-cloud-shell`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index 4270260..66e8922 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_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.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.shell_v1.types import cloudshell @@ -174,10 +176,10 @@ def __init__( async def get_environment( self, - request: cloudshell.GetEnvironmentRequest = None, + request: Union[cloudshell.GetEnvironmentRequest, 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]] = (), ) -> cloudshell.Environment: @@ -185,7 +187,7 @@ async def get_environment( not exist. Args: - request (:class:`google.cloud.shell_v1.types.GetEnvironmentRequest`): + request (Union[google.cloud.shell_v1.types.GetEnvironmentRequest, dict]): The request object. Request message for [GetEnvironment][google.cloud.shell.v1.CloudShellService.GetEnvironment]. name (:class:`str`): @@ -262,9 +264,9 @@ async def get_environment( async def start_environment( self, - request: cloudshell.StartEnvironmentRequest = None, + request: Union[cloudshell.StartEnvironmentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -278,7 +280,7 @@ async def start_environment( StartEnvironmentResponse in its response field. Args: - request (:class:`google.cloud.shell_v1.types.StartEnvironmentRequest`): + request (Union[google.cloud.shell_v1.types.StartEnvironmentRequest, dict]): The request object. Request message for [StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -329,9 +331,9 @@ async def start_environment( async def authorize_environment( self, - request: cloudshell.AuthorizeEnvironmentRequest = None, + request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -342,7 +344,7 @@ async def authorize_environment( authenticate. Args: - request (:class:`google.cloud.shell_v1.types.AuthorizeEnvironmentRequest`): + request (Union[google.cloud.shell_v1.types.AuthorizeEnvironmentRequest, dict]): The request object. Request message for [AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -392,9 +394,9 @@ async def authorize_environment( async def add_public_key( self, - request: cloudshell.AddPublicKeyRequest = None, + request: Union[cloudshell.AddPublicKeyRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -404,7 +406,7 @@ async def add_public_key( error with ALREADY_EXISTS. Args: - request (:class:`google.cloud.shell_v1.types.AddPublicKeyRequest`): + request (Union[google.cloud.shell_v1.types.AddPublicKeyRequest, dict]): The request object. Request message for [AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -456,9 +458,9 @@ async def add_public_key( async def remove_public_key( self, - request: cloudshell.RemovePublicKeyRequest = None, + request: Union[cloudshell.RemovePublicKeyRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -468,7 +470,7 @@ async def remove_public_key( present, this will error with NOT_FOUND. Args: - request (:class:`google.cloud.shell_v1.types.RemovePublicKeyRequest`): + request (Union[google.cloud.shell_v1.types.RemovePublicKeyRequest, dict]): The request object. Request message for [RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey]. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 7636ef9..3cf24e2 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_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.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.shell_v1.types import cloudshell @@ -360,7 +362,7 @@ def get_environment( request: Union[cloudshell.GetEnvironmentRequest, 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]] = (), ) -> cloudshell.Environment: @@ -438,7 +440,7 @@ def start_environment( self, request: Union[cloudshell.StartEnvironmentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -506,7 +508,7 @@ def authorize_environment( self, request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -570,7 +572,7 @@ def add_public_key( self, request: Union[cloudshell.AddPublicKeyRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -635,7 +637,7 @@ def remove_public_key( self, request: Union[cloudshell.RemovePublicKeyRequest, dict] = None, *, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index 6d17783..74af637 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_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 @@ -37,15 +36,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 CloudShellServiceTransport(abc.ABC): """Abstract transport class for CloudShellService.""" @@ -95,7 +85,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 @@ -128,29 +118,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 = { @@ -194,7 +161,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py index b9acc49..64a6687 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py @@ -119,7 +119,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py index a89f322..cd1624b 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # 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 @@ -166,7 +165,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/noxfile.py b/noxfile.py index 2bb4cf7..2a2001c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -101,7 +101,7 @@ def default(session): "py.test", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", - "--cov=google/cloud", + "--cov=google", "--cov=tests/unit", "--cov-append", "--cov-config=.coveragerc", diff --git a/setup.py b/setup.py index 7851c99..ba53e0a 100644 --- a/setup.py +++ b/setup.py @@ -22,16 +22,15 @@ name = "google-cloud-shell" description = "Cloud Shell API client library" -version = "1.2.0" +version = "1.2.1" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-shell" dependencies = [ # 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.15.0", - "packaging >= 14.3", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 3b213fb..aff6bee 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,7 +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.15.0 -packaging==14.3 -google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-auth \ No newline at end of file diff --git a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py index c3df581..6903c1d 100644 --- a/tests/unit/gapic/shell_v1/test_cloud_shell_service.py +++ b/tests/unit/gapic/shell_v1/test_cloud_shell_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) from google.cloud.shell_v1.services.cloud_shell_service import CloudShellServiceClient from google.cloud.shell_v1.services.cloud_shell_service import transports -from google.cloud.shell_v1.services.cloud_shell_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.shell_v1.types import cloudshell from google.longrunning import operations_pb2 from google.oauth2 import service_account @@ -50,20 +46,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" @@ -221,7 +203,7 @@ def test_cloud_shell_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, @@ -238,7 +220,7 @@ def test_cloud_shell_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, @@ -255,7 +237,7 @@ def test_cloud_shell_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, @@ -284,7 +266,7 @@ def test_cloud_shell_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, @@ -353,7 +335,7 @@ def test_cloud_shell_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 @@ -395,7 +377,7 @@ def test_cloud_shell_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, @@ -417,7 +399,7 @@ def test_cloud_shell_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, @@ -448,7 +430,7 @@ def test_cloud_shell_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, @@ -479,7 +461,7 @@ def test_cloud_shell_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", @@ -1424,7 +1406,6 @@ def test_cloud_shell_service_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_cloud_shell_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -1445,26 +1426,6 @@ def test_cloud_shell_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_cloud_shell_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.cloud.shell_v1.services.cloud_shell_service.transports.CloudShellServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CloudShellServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_cloud_shell_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( @@ -1476,7 +1437,6 @@ def test_cloud_shell_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_cloud_shell_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -1489,18 +1449,6 @@ def test_cloud_shell_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_cloud_shell_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) - CloudShellServiceClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -1508,7 +1456,6 @@ def test_cloud_shell_service_auth_adc_old_google_auth(): transports.CloudShellServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_cloud_shell_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -1522,26 +1469,6 @@ def test_cloud_shell_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.CloudShellServiceGrpcTransport, - transports.CloudShellServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_cloud_shell_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/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [