From cb72c1a5e5adfe860ef26c463b50e8ddd3225f18 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 25 Aug 2020 21:53:25 -0700 Subject: [PATCH] chore: updates to generated code (#31) --- .../reservation_service/async_client.py | 54 ++++++----- .../services/reservation_service/client.py | 13 ++- .../reservation_service/transports/base.py | 52 +++++----- .../reservation_service/transports/grpc.py | 16 +++- .../transports/grpc_asyncio.py | 10 +- .../synth.metadata | 2 +- .../test_reservation_service.py | 95 ++++++++++++------- 7 files changed, 153 insertions(+), 89 deletions(-) diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py index 4049a75db099..5c96bd259007 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py @@ -35,7 +35,7 @@ from google.protobuf import timestamp_pb2 as timestamp # type: ignore from google.rpc import status_pb2 as status # type: ignore -from .transports.base import ReservationServiceTransport +from .transports.base import ReservationServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ReservationServiceGrpcAsyncIOTransport from .client import ReservationServiceClient @@ -65,14 +65,14 @@ class ReservationServiceAsyncClient: DEFAULT_ENDPOINT = ReservationServiceClient.DEFAULT_ENDPOINT DEFAULT_MTLS_ENDPOINT = ReservationServiceClient.DEFAULT_MTLS_ENDPOINT - assignment_path = staticmethod(ReservationServiceClient.assignment_path) - bi_reservation_path = staticmethod(ReservationServiceClient.bi_reservation_path) capacity_commitment_path = staticmethod( ReservationServiceClient.capacity_commitment_path ) + assignment_path = staticmethod(ReservationServiceClient.assignment_path) + reservation_path = staticmethod(ReservationServiceClient.reservation_path) from_service_account_file = ReservationServiceClient.from_service_account_file @@ -89,6 +89,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ReservationServiceTransport] = "grpc_asyncio", client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the reservation service client. @@ -121,7 +122,10 @@ def __init__( """ self._client = ReservationServiceClient( - credentials=credentials, transport=transport, client_options=client_options, + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, ) async def create_reservation( @@ -200,7 +204,7 @@ async def create_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -275,7 +279,7 @@ async def list_reservations( rpc = gapic_v1.method_async.wrap_method( self._client._transport.list_reservations, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -353,7 +357,7 @@ async def get_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -421,7 +425,7 @@ async def delete_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -499,7 +503,7 @@ async def update_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -593,7 +597,7 @@ async def create_capacity_commitment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -668,7 +672,7 @@ async def list_capacity_commitments( rpc = gapic_v1.method_async.wrap_method( self._client._transport.list_capacity_commitments, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -758,7 +762,7 @@ async def get_capacity_commitment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -826,7 +830,7 @@ async def delete_capacity_commitment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -924,7 +928,7 @@ async def update_capacity_commitment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1014,7 +1018,7 @@ async def split_capacity_commitment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.split_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1120,7 +1124,7 @@ async def merge_capacity_commitments( rpc = gapic_v1.method_async.wrap_method( self._client._transport.merge_capacity_commitments, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1234,7 +1238,7 @@ async def create_assignment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_assignment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1334,7 +1338,7 @@ async def list_assignments( rpc = gapic_v1.method_async.wrap_method( self._client._transport.list_assignments, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1422,7 +1426,7 @@ async def delete_assignment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_assignment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1537,7 +1541,7 @@ async def search_assignments( rpc = gapic_v1.method_async.wrap_method( self._client._transport.search_assignments, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1634,7 +1638,7 @@ async def move_assignment( rpc = gapic_v1.method_async.wrap_method( self._client._transport.move_assignment, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1704,7 +1708,7 @@ async def get_bi_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_bi_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1788,7 +1792,7 @@ async def update_bi_reservation( rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_bi_reservation, default_timeout=None, - client_info=_client_info, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; @@ -1807,13 +1811,13 @@ async def update_bi_reservation( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( "google-cloud-bigquery-reservation", ).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ReservationServiceAsyncClient",) diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py index 2b3d75bef466..3cdf0db17a5c 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/client.py @@ -37,7 +37,7 @@ from google.protobuf import timestamp_pb2 as timestamp # type: ignore from google.rpc import status_pb2 as status # type: ignore -from .transports.base import ReservationServiceTransport +from .transports.base import ReservationServiceTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ReservationServiceGrpcTransport from .transports.grpc_asyncio import ReservationServiceGrpcAsyncIOTransport @@ -228,6 +228,7 @@ def __init__( credentials: credentials.Credentials = None, transport: Union[str, ReservationServiceTransport] = None, client_options: ClientOptions = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the reservation service client. @@ -253,6 +254,11 @@ def __init__( (2) The ``client_cert_source`` property is used to provide client SSL credentials for mutual TLS transport. If not provided, the default SSL credentials will be used if present. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -310,6 +316,7 @@ def __init__( api_mtls_endpoint=client_options.api_endpoint, client_cert_source=client_options.client_cert_source, quota_project_id=client_options.quota_project_id, + client_info=client_info, ) def create_reservation( @@ -2045,13 +2052,13 @@ def update_bi_reservation( try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( "google-cloud-bigquery-reservation", ).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() __all__ = ("ReservationServiceClient",) diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py index 82e5fd6bc8da..abc9d35d0f9c 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py @@ -31,13 +31,13 @@ try: - _client_info = gapic_v1.client_info.ClientInfo( + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( "google-cloud-bigquery-reservation", ).version, ) except pkg_resources.DistributionNotFound: - _client_info = gapic_v1.client_info.ClientInfo() + DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() class ReservationServiceTransport(abc.ABC): @@ -56,6 +56,7 @@ def __init__( credentials_file: typing.Optional[str] = None, scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, quota_project_id: typing.Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, **kwargs, ) -> None: """Instantiate the transport. @@ -73,6 +74,11 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -100,83 +106,83 @@ def __init__( self._credentials = credentials # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages() + self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self): + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_reservation: gapic_v1.method.wrap_method( - self.create_reservation, default_timeout=None, client_info=_client_info, + self.create_reservation, default_timeout=None, client_info=client_info, ), self.list_reservations: gapic_v1.method.wrap_method( - self.list_reservations, default_timeout=None, client_info=_client_info, + self.list_reservations, default_timeout=None, client_info=client_info, ), self.get_reservation: gapic_v1.method.wrap_method( - self.get_reservation, default_timeout=None, client_info=_client_info, + self.get_reservation, default_timeout=None, client_info=client_info, ), self.delete_reservation: gapic_v1.method.wrap_method( - self.delete_reservation, default_timeout=None, client_info=_client_info, + self.delete_reservation, default_timeout=None, client_info=client_info, ), self.update_reservation: gapic_v1.method.wrap_method( - self.update_reservation, default_timeout=None, client_info=_client_info, + self.update_reservation, default_timeout=None, client_info=client_info, ), self.create_capacity_commitment: gapic_v1.method.wrap_method( self.create_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.list_capacity_commitments: gapic_v1.method.wrap_method( self.list_capacity_commitments, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.get_capacity_commitment: gapic_v1.method.wrap_method( self.get_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.delete_capacity_commitment: gapic_v1.method.wrap_method( self.delete_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.update_capacity_commitment: gapic_v1.method.wrap_method( self.update_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.split_capacity_commitment: gapic_v1.method.wrap_method( self.split_capacity_commitment, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.merge_capacity_commitments: gapic_v1.method.wrap_method( self.merge_capacity_commitments, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), self.create_assignment: gapic_v1.method.wrap_method( - self.create_assignment, default_timeout=None, client_info=_client_info, + self.create_assignment, default_timeout=None, client_info=client_info, ), self.list_assignments: gapic_v1.method.wrap_method( - self.list_assignments, default_timeout=None, client_info=_client_info, + self.list_assignments, default_timeout=None, client_info=client_info, ), self.delete_assignment: gapic_v1.method.wrap_method( - self.delete_assignment, default_timeout=None, client_info=_client_info, + self.delete_assignment, default_timeout=None, client_info=client_info, ), self.search_assignments: gapic_v1.method.wrap_method( - self.search_assignments, default_timeout=None, client_info=_client_info, + self.search_assignments, default_timeout=None, client_info=client_info, ), self.move_assignment: gapic_v1.method.wrap_method( - self.move_assignment, default_timeout=None, client_info=_client_info, + self.move_assignment, default_timeout=None, client_info=client_info, ), self.get_bi_reservation: gapic_v1.method.wrap_method( - self.get_bi_reservation, default_timeout=None, client_info=_client_info, + self.get_bi_reservation, default_timeout=None, client_info=client_info, ), self.update_bi_reservation: gapic_v1.method.wrap_method( self.update_bi_reservation, default_timeout=None, - client_info=_client_info, + client_info=client_info, ), } diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc.py index 16987fe9f9b2..3f27bbd662f3 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc.py @@ -18,6 +18,7 @@ from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore +from google.api_core import gapic_v1 # type: ignore from google import auth # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -29,7 +30,7 @@ from google.cloud.bigquery.reservation_v1.types import reservation as gcbr_reservation from google.protobuf import empty_pb2 as empty # type: ignore -from .base import ReservationServiceTransport +from .base import ReservationServiceTransport, DEFAULT_CLIENT_INFO class ReservationServiceGrpcTransport(ReservationServiceTransport): @@ -73,7 +74,8 @@ def __init__( channel: grpc.Channel = None, api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id: Optional[str] = None + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -102,6 +104,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -157,6 +164,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) @classmethod @@ -167,7 +175,7 @@ def create_channel( credentials_file: str = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, - **kwargs + **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: @@ -201,7 +209,7 @@ def create_channel( credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, - **kwargs + **kwargs, ) @property diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc_asyncio.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc_asyncio.py index 36cfa61f2236..9a7dc6d239ec 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc_asyncio.py @@ -17,6 +17,7 @@ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple +from google.api_core import gapic_v1 # type: ignore from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore @@ -28,7 +29,7 @@ from google.cloud.bigquery.reservation_v1.types import reservation as gcbr_reservation from google.protobuf import empty_pb2 as empty # type: ignore -from .base import ReservationServiceTransport +from .base import ReservationServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ReservationServiceGrpcTransport @@ -116,6 +117,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. @@ -145,6 +147,11 @@ def __init__( is None. quota_project_id (Optional[str]): An optional project to use for billing and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -193,6 +200,7 @@ def __init__( credentials_file=credentials_file, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, + client_info=client_info, ) self._stubs = {} diff --git a/packages/google-cloud-bigquery-reservation/synth.metadata b/packages/google-cloud-bigquery-reservation/synth.metadata index 2c301dea0b98..d4a93d9afd2c 100644 --- a/packages/google-cloud-bigquery-reservation/synth.metadata +++ b/packages/google-cloud-bigquery-reservation/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-bigquery-reservation.git", - "sha": "a0e818d526dc60f0eb24787333e1041b02f26816" + "sha": "50c85777ae70735fb06c8a7a1b0d6a82a28766c3" } }, { diff --git a/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py index 15a31be0ed16..86e693c4502d 100644 --- a/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py +++ b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py @@ -168,6 +168,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -184,6 +185,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is @@ -200,6 +202,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -219,6 +222,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=client_cert_source_callback, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -239,6 +243,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is @@ -259,6 +264,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has @@ -280,6 +286,7 @@ def test_reservation_service_client_client_options( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -310,6 +317,7 @@ def test_reservation_service_client_client_options_scopes( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -340,6 +348,7 @@ def test_reservation_service_client_client_options_credentials_file( api_mtls_endpoint=client.DEFAULT_ENDPOINT, client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -359,6 +368,7 @@ def test_reservation_service_client_client_options_from_dict(): api_mtls_endpoint="squid.clam.whelk", client_cert_source=None, quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -5525,38 +5535,6 @@ def test_reservation_service_grpc_asyncio_transport_channel_mtls_with_adc( assert transport.grpc_channel == mock_grpc_channel -def test_assignment_path(): - project = "squid" - location = "clam" - reservation = "whelk" - assignment = "octopus" - - expected = "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}".format( - project=project, - location=location, - reservation=reservation, - assignment=assignment, - ) - actual = ReservationServiceClient.assignment_path( - project, location, reservation, assignment - ) - assert expected == actual - - -def test_parse_assignment_path(): - expected = { - "project": "oyster", - "location": "nudibranch", - "reservation": "cuttlefish", - "assignment": "mussel", - } - path = ReservationServiceClient.assignment_path(**expected) - - # Check that the path construction is reversible. - actual = ReservationServiceClient.parse_assignment_path(path) - assert expected == actual - - def test_bi_reservation_path(): project = "squid" location = "clam" @@ -5607,6 +5585,38 @@ def test_parse_capacity_commitment_path(): assert expected == actual +def test_assignment_path(): + project = "squid" + location = "clam" + reservation = "whelk" + assignment = "octopus" + + expected = "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}".format( + project=project, + location=location, + reservation=reservation, + assignment=assignment, + ) + actual = ReservationServiceClient.assignment_path( + project, location, reservation, assignment + ) + assert expected == actual + + +def test_parse_assignment_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "reservation": "cuttlefish", + "assignment": "mussel", + } + path = ReservationServiceClient.assignment_path(**expected) + + # Check that the path construction is reversible. + actual = ReservationServiceClient.parse_assignment_path(path) + assert expected == actual + + def test_reservation_path(): project = "squid" location = "clam" @@ -5630,3 +5640,24 @@ def test_parse_reservation_path(): # Check that the path construction is reversible. actual = ReservationServiceClient.parse_reservation_path(path) assert expected == actual + + +def test_client_withDEFAULT_CLIENT_INFO(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object( + transports.ReservationServiceTransport, "_prep_wrapped_messages" + ) as prep: + client = ReservationServiceClient( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object( + transports.ReservationServiceTransport, "_prep_wrapped_messages" + ) as prep: + transport_class = ReservationServiceClient.get_transport_class() + transport = transport_class( + credentials=credentials.AnonymousCredentials(), client_info=client_info, + ) + prep.assert_called_once_with(client_info)