From 299553d2cc9e93771ab9b680fe92000707e3f941 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 5 Aug 2021 23:03:59 +0000 Subject: [PATCH 1/5] fix(monolith): Bump microgenerator versions to monolith removal * fix(php): Bump microgenerator version * fix(monolith): Bump microgenerator versions with monolith removal Source-Author: Mira Leung Source-Date: Wed Jun 23 12:35:59 2021 -0700 Source-Repo: googleapis/googleapis-discovery Source-Sha: 6a189a8bada35e2657a67b903cad7fee649f2dbc Source-Link: https://github.com/googleapis/googleapis-discovery/commit/6a189a8bada35e2657a67b903cad7fee649f2dbc --- .../services/accelerator_types/transports/base.py | 12 ++++++++++++ .../compute_v1/services/addresses/transports/base.py | 12 ++++++++++++ .../services/autoscalers/transports/base.py | 12 ++++++++++++ .../services/backend_buckets/transports/base.py | 12 ++++++++++++ .../services/backend_services/transports/base.py | 12 ++++++++++++ .../services/disk_types/transports/base.py | 12 ++++++++++++ .../compute_v1/services/disks/transports/base.py | 12 ++++++++++++ .../external_vpn_gateways/transports/base.py | 12 ++++++++++++ .../services/firewall_policies/transports/base.py | 12 ++++++++++++ .../compute_v1/services/firewalls/transports/base.py | 12 ++++++++++++ .../services/forwarding_rules/transports/base.py | 12 ++++++++++++ .../services/global_addresses/transports/base.py | 12 ++++++++++++ .../global_forwarding_rules/transports/base.py | 12 ++++++++++++ .../transports/base.py | 12 ++++++++++++ .../services/global_operations/transports/base.py | 12 ++++++++++++ .../transports/base.py | 12 ++++++++++++ .../transports/base.py | 12 ++++++++++++ .../services/health_checks/transports/base.py | 12 ++++++++++++ .../compute_v1/services/images/transports/base.py | 12 ++++++++++++ .../instance_group_managers/transports/base.py | 12 ++++++++++++ .../services/instance_groups/transports/base.py | 12 ++++++++++++ .../services/instance_templates/transports/base.py | 12 ++++++++++++ .../compute_v1/services/instances/transports/base.py | 12 ++++++++++++ .../interconnect_attachments/transports/base.py | 12 ++++++++++++ .../interconnect_locations/transports/base.py | 12 ++++++++++++ .../services/interconnects/transports/base.py | 12 ++++++++++++ .../services/license_codes/transports/base.py | 12 ++++++++++++ .../compute_v1/services/licenses/transports/base.py | 12 ++++++++++++ .../services/machine_types/transports/base.py | 12 ++++++++++++ .../network_endpoint_groups/transports/base.py | 12 ++++++++++++ .../compute_v1/services/networks/transports/base.py | 12 ++++++++++++ .../services/node_groups/transports/base.py | 12 ++++++++++++ .../services/node_templates/transports/base.py | 12 ++++++++++++ .../services/node_types/transports/base.py | 12 ++++++++++++ .../services/packet_mirrorings/transports/base.py | 12 ++++++++++++ .../compute_v1/services/projects/transports/base.py | 12 ++++++++++++ .../public_advertised_prefixes/transports/base.py | 12 ++++++++++++ .../public_delegated_prefixes/transports/base.py | 12 ++++++++++++ .../services/region_autoscalers/transports/base.py | 12 ++++++++++++ .../region_backend_services/transports/base.py | 12 ++++++++++++ .../services/region_commitments/transports/base.py | 12 ++++++++++++ .../services/region_disk_types/transports/base.py | 12 ++++++++++++ .../services/region_disks/transports/base.py | 12 ++++++++++++ .../region_health_check_services/transports/base.py | 12 ++++++++++++ .../services/region_health_checks/transports/base.py | 12 ++++++++++++ .../transports/base.py | 12 ++++++++++++ .../region_instance_groups/transports/base.py | 12 ++++++++++++ .../services/region_instances/transports/base.py | 12 ++++++++++++ .../transports/base.py | 12 ++++++++++++ .../region_notification_endpoints/transports/base.py | 12 ++++++++++++ .../services/region_operations/transports/base.py | 12 ++++++++++++ .../region_ssl_certificates/transports/base.py | 12 ++++++++++++ .../region_target_http_proxies/transports/base.py | 12 ++++++++++++ .../region_target_https_proxies/transports/base.py | 12 ++++++++++++ .../services/region_url_maps/transports/base.py | 12 ++++++++++++ .../compute_v1/services/regions/transports/base.py | 12 ++++++++++++ .../services/reservations/transports/base.py | 12 ++++++++++++ .../services/resource_policies/transports/base.py | 12 ++++++++++++ .../compute_v1/services/routers/transports/base.py | 12 ++++++++++++ .../compute_v1/services/routes/transports/base.py | 12 ++++++++++++ .../services/security_policies/transports/base.py | 12 ++++++++++++ .../compute_v1/services/snapshots/transports/base.py | 12 ++++++++++++ .../services/ssl_certificates/transports/base.py | 12 ++++++++++++ .../services/ssl_policies/transports/base.py | 12 ++++++++++++ .../services/subnetworks/transports/base.py | 12 ++++++++++++ .../services/target_grpc_proxies/transports/base.py | 12 ++++++++++++ .../services/target_http_proxies/transports/base.py | 12 ++++++++++++ .../services/target_https_proxies/transports/base.py | 12 ++++++++++++ .../services/target_instances/transports/base.py | 12 ++++++++++++ .../services/target_pools/transports/base.py | 12 ++++++++++++ .../services/target_ssl_proxies/transports/base.py | 12 ++++++++++++ .../services/target_tcp_proxies/transports/base.py | 12 ++++++++++++ .../services/target_vpn_gateways/transports/base.py | 12 ++++++++++++ .../compute_v1/services/url_maps/transports/base.py | 12 ++++++++++++ .../services/vpn_gateways/transports/base.py | 12 ++++++++++++ .../services/vpn_tunnels/transports/base.py | 12 ++++++++++++ .../services/zone_operations/transports/base.py | 12 ++++++++++++ .../compute_v1/services/zones/transports/base.py | 12 ++++++++++++ synth.metadata | 4 ++-- .../unit/gapic/compute_v1/test_accelerator_types.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_addresses.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_autoscalers.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_backend_buckets.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_backend_services.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_disk_types.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_disks.py | 10 ++++++++++ .../gapic/compute_v1/test_external_vpn_gateways.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_firewall_policies.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_firewalls.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_forwarding_rules.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_global_addresses.py | 10 ++++++++++ .../gapic/compute_v1/test_global_forwarding_rules.py | 10 ++++++++++ .../test_global_network_endpoint_groups.py | 12 ++++++++++++ .../unit/gapic/compute_v1/test_global_operations.py | 10 ++++++++++ .../test_global_organization_operations.py | 12 ++++++++++++ .../test_global_public_delegated_prefixes.py | 12 ++++++++++++ tests/unit/gapic/compute_v1/test_health_checks.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_images.py | 10 ++++++++++ .../gapic/compute_v1/test_instance_group_managers.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_instance_groups.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_instance_templates.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_instances.py | 10 ++++++++++ .../compute_v1/test_interconnect_attachments.py | 10 ++++++++++ .../gapic/compute_v1/test_interconnect_locations.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_interconnects.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_license_codes.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_licenses.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_machine_types.py | 10 ++++++++++ .../gapic/compute_v1/test_network_endpoint_groups.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_networks.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_node_groups.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_node_templates.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_node_types.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_packet_mirrorings.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_projects.py | 10 ++++++++++ .../compute_v1/test_public_advertised_prefixes.py | 10 ++++++++++ .../compute_v1/test_public_delegated_prefixes.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_region_autoscalers.py | 10 ++++++++++ .../gapic/compute_v1/test_region_backend_services.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_region_commitments.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_region_disk_types.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_region_disks.py | 10 ++++++++++ .../compute_v1/test_region_health_check_services.py | 12 ++++++++++++ .../gapic/compute_v1/test_region_health_checks.py | 10 ++++++++++ .../test_region_instance_group_managers.py | 12 ++++++++++++ .../gapic/compute_v1/test_region_instance_groups.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_region_instances.py | 10 ++++++++++ .../test_region_network_endpoint_groups.py | 12 ++++++++++++ .../compute_v1/test_region_notification_endpoints.py | 12 ++++++++++++ .../unit/gapic/compute_v1/test_region_operations.py | 10 ++++++++++ .../gapic/compute_v1/test_region_ssl_certificates.py | 10 ++++++++++ .../compute_v1/test_region_target_http_proxies.py | 10 ++++++++++ .../compute_v1/test_region_target_https_proxies.py | 12 ++++++++++++ tests/unit/gapic/compute_v1/test_region_url_maps.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_regions.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_reservations.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_resource_policies.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_routers.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_routes.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_security_policies.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_snapshots.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_ssl_certificates.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_ssl_policies.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_subnetworks.py | 10 ++++++++++ .../gapic/compute_v1/test_target_grpc_proxies.py | 10 ++++++++++ .../gapic/compute_v1/test_target_http_proxies.py | 10 ++++++++++ .../gapic/compute_v1/test_target_https_proxies.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_target_instances.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_target_pools.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_target_ssl_proxies.py | 10 ++++++++++ .../unit/gapic/compute_v1/test_target_tcp_proxies.py | 10 ++++++++++ .../gapic/compute_v1/test_target_vpn_gateways.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_url_maps.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_vpn_gateways.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_vpn_tunnels.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_zone_operations.py | 10 ++++++++++ tests/unit/gapic/compute_v1/test_zones.py | 10 ++++++++++ 157 files changed, 1734 insertions(+), 2 deletions(-) diff --git a/google/cloud/compute_v1/services/accelerator_types/transports/base.py b/google/cloud/compute_v1/services/accelerator_types/transports/base.py index f5d37dd1a..b4366b11c 100644 --- a/google/cloud/compute_v1/services/accelerator_types/transports/base.py +++ b/google/cloud/compute_v1/services/accelerator_types/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/addresses/transports/base.py b/google/cloud/compute_v1/services/addresses/transports/base.py index c14ad63c8..093fd33cf 100644 --- a/google/cloud/compute_v1/services/addresses/transports/base.py +++ b/google/cloud/compute_v1/services/addresses/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/autoscalers/transports/base.py b/google/cloud/compute_v1/services/autoscalers/transports/base.py index 109e91eb5..73aa2d209 100644 --- a/google/cloud/compute_v1/services/autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/autoscalers/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/backend_buckets/transports/base.py b/google/cloud/compute_v1/services/backend_buckets/transports/base.py index 4526d6929..929eb3507 100644 --- a/google/cloud/compute_v1/services/backend_buckets/transports/base.py +++ b/google/cloud/compute_v1/services/backend_buckets/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/backend_services/transports/base.py b/google/cloud/compute_v1/services/backend_services/transports/base.py index 47392e6d4..3067603cf 100644 --- a/google/cloud/compute_v1/services/backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/backend_services/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/disk_types/transports/base.py b/google/cloud/compute_v1/services/disk_types/transports/base.py index c44914d3c..16b858cc1 100644 --- a/google/cloud/compute_v1/services/disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/disk_types/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/disks/transports/base.py b/google/cloud/compute_v1/services/disks/transports/base.py index 1d6b21eeb..0ad9e2cab 100644 --- a/google/cloud/compute_v1/services/disks/transports/base.py +++ b/google/cloud/compute_v1/services/disks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py index f0a2d8d64..3ea65043f 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/firewall_policies/transports/base.py b/google/cloud/compute_v1/services/firewall_policies/transports/base.py index 6893c06e7..0b6d41da9 100644 --- a/google/cloud/compute_v1/services/firewall_policies/transports/base.py +++ b/google/cloud/compute_v1/services/firewall_policies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/firewalls/transports/base.py b/google/cloud/compute_v1/services/firewalls/transports/base.py index 49f7a4f84..0905823fd 100644 --- a/google/cloud/compute_v1/services/firewalls/transports/base.py +++ b/google/cloud/compute_v1/services/firewalls/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py index 54a77e731..5127bbe7f 100644 --- a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_addresses/transports/base.py b/google/cloud/compute_v1/services/global_addresses/transports/base.py index 59d3eedaf..37dc347cf 100644 --- a/google/cloud/compute_v1/services/global_addresses/transports/base.py +++ b/google/cloud/compute_v1/services/global_addresses/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py index 5bb754614..97156c55e 100644 --- a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py index 64c3f6d8f..7ffeb20bd 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_operations/transports/base.py b/google/cloud/compute_v1/services/global_operations/transports/base.py index 739ea7228..e092e53df 100644 --- a/google/cloud/compute_v1/services/global_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_operations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py index bc05e03b7..a926ecf00 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py index 38fd07454..921b53d29 100644 --- a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/health_checks/transports/base.py b/google/cloud/compute_v1/services/health_checks/transports/base.py index c4088ac14..fa925f200 100644 --- a/google/cloud/compute_v1/services/health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/health_checks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/images/transports/base.py b/google/cloud/compute_v1/services/images/transports/base.py index 96cd7abcf..c71196d3a 100644 --- a/google/cloud/compute_v1/services/images/transports/base.py +++ b/google/cloud/compute_v1/services/images/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py index 624aabce5..c0c516b4a 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/instance_groups/transports/base.py b/google/cloud/compute_v1/services/instance_groups/transports/base.py index 4fa60b1d2..90133594b 100644 --- a/google/cloud/compute_v1/services/instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/instance_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/instance_templates/transports/base.py b/google/cloud/compute_v1/services/instance_templates/transports/base.py index 2fae32fff..d71f8df84 100644 --- a/google/cloud/compute_v1/services/instance_templates/transports/base.py +++ b/google/cloud/compute_v1/services/instance_templates/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/instances/transports/base.py b/google/cloud/compute_v1/services/instances/transports/base.py index 729435037..877b77616 100644 --- a/google/cloud/compute_v1/services/instances/transports/base.py +++ b/google/cloud/compute_v1/services/instances/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py index 23091650b..68e36ccf5 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py index 1fe9646b0..85a50f525 100644 --- a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/interconnects/transports/base.py b/google/cloud/compute_v1/services/interconnects/transports/base.py index 5592165ad..ffca672b2 100644 --- a/google/cloud/compute_v1/services/interconnects/transports/base.py +++ b/google/cloud/compute_v1/services/interconnects/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/license_codes/transports/base.py b/google/cloud/compute_v1/services/license_codes/transports/base.py index 02063d777..ebfaeff82 100644 --- a/google/cloud/compute_v1/services/license_codes/transports/base.py +++ b/google/cloud/compute_v1/services/license_codes/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/licenses/transports/base.py b/google/cloud/compute_v1/services/licenses/transports/base.py index d3ff14836..7948a3cfe 100644 --- a/google/cloud/compute_v1/services/licenses/transports/base.py +++ b/google/cloud/compute_v1/services/licenses/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/machine_types/transports/base.py b/google/cloud/compute_v1/services/machine_types/transports/base.py index 587a0521f..67325ee16 100644 --- a/google/cloud/compute_v1/services/machine_types/transports/base.py +++ b/google/cloud/compute_v1/services/machine_types/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py index 4072d4189..cce98b100 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/networks/transports/base.py b/google/cloud/compute_v1/services/networks/transports/base.py index b2c5fae29..33fd4828e 100644 --- a/google/cloud/compute_v1/services/networks/transports/base.py +++ b/google/cloud/compute_v1/services/networks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/node_groups/transports/base.py b/google/cloud/compute_v1/services/node_groups/transports/base.py index 8137c560c..f918842ea 100644 --- a/google/cloud/compute_v1/services/node_groups/transports/base.py +++ b/google/cloud/compute_v1/services/node_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/node_templates/transports/base.py b/google/cloud/compute_v1/services/node_templates/transports/base.py index 6d1b2d36a..bce68a5a0 100644 --- a/google/cloud/compute_v1/services/node_templates/transports/base.py +++ b/google/cloud/compute_v1/services/node_templates/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/node_types/transports/base.py b/google/cloud/compute_v1/services/node_types/transports/base.py index dc7874707..7f692ba40 100644 --- a/google/cloud/compute_v1/services/node_types/transports/base.py +++ b/google/cloud/compute_v1/services/node_types/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py index db05b3792..cceb1b53b 100644 --- a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py +++ b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/projects/transports/base.py b/google/cloud/compute_v1/services/projects/transports/base.py index 8b8d63f3d..2a448cf29 100644 --- a/google/cloud/compute_v1/services/projects/transports/base.py +++ b/google/cloud/compute_v1/services/projects/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py index 4bd53f7c3..f736429d5 100644 --- a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py index 564ce9f44..1dc41b672 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py index a5db46286..3bbd2ecd9 100644 --- a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_backend_services/transports/base.py b/google/cloud/compute_v1/services/region_backend_services/transports/base.py index e6938dbc3..f8afc7289 100644 --- a/google/cloud/compute_v1/services/region_backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_backend_services/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_commitments/transports/base.py b/google/cloud/compute_v1/services/region_commitments/transports/base.py index 3ff989995..849e5e64d 100644 --- a/google/cloud/compute_v1/services/region_commitments/transports/base.py +++ b/google/cloud/compute_v1/services/region_commitments/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_disk_types/transports/base.py b/google/cloud/compute_v1/services/region_disk_types/transports/base.py index d1eba1378..0f609bcf6 100644 --- a/google/cloud/compute_v1/services/region_disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/region_disk_types/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_disks/transports/base.py b/google/cloud/compute_v1/services/region_disks/transports/base.py index 4c6b45b9a..9a8d57cb4 100644 --- a/google/cloud/compute_v1/services/region_disks/transports/base.py +++ b/google/cloud/compute_v1/services/region_disks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py index 73603b9ab..2c976b214 100644 --- a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_health_checks/transports/base.py b/google/cloud/compute_v1/services/region_health_checks/transports/base.py index 718974545..808f03eea 100644 --- a/google/cloud/compute_v1/services/region_health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_checks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py index 445228e5b..1e0cad0de 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py index e99b410c4..db5b274eb 100644 --- a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_instances/transports/base.py b/google/cloud/compute_v1/services/region_instances/transports/base.py index 1891660e9..427fcf83f 100644 --- a/google/cloud/compute_v1/services/region_instances/transports/base.py +++ b/google/cloud/compute_v1/services/region_instances/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py index 39098f4f5..7e19aa1f9 100644 --- a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py index ec605dee9..581426cc1 100644 --- a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py +++ b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_operations/transports/base.py b/google/cloud/compute_v1/services/region_operations/transports/base.py index 1e86fe9be..8786bc3f2 100644 --- a/google/cloud/compute_v1/services/region_operations/transports/base.py +++ b/google/cloud/compute_v1/services/region_operations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py index 9366e3a41..aab82ba1f 100644 --- a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py index a86add99d..8ccca0754 100644 --- a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py index 06ee8b06d..e40df34c5 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/region_url_maps/transports/base.py b/google/cloud/compute_v1/services/region_url_maps/transports/base.py index 55db53c6a..90547481a 100644 --- a/google/cloud/compute_v1/services/region_url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/region_url_maps/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/regions/transports/base.py b/google/cloud/compute_v1/services/regions/transports/base.py index 37ff0b0a4..da819431a 100644 --- a/google/cloud/compute_v1/services/regions/transports/base.py +++ b/google/cloud/compute_v1/services/regions/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/reservations/transports/base.py b/google/cloud/compute_v1/services/reservations/transports/base.py index c56cccc8b..c4a26ffdd 100644 --- a/google/cloud/compute_v1/services/reservations/transports/base.py +++ b/google/cloud/compute_v1/services/reservations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/resource_policies/transports/base.py b/google/cloud/compute_v1/services/resource_policies/transports/base.py index 46617a036..075c013fc 100644 --- a/google/cloud/compute_v1/services/resource_policies/transports/base.py +++ b/google/cloud/compute_v1/services/resource_policies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/routers/transports/base.py b/google/cloud/compute_v1/services/routers/transports/base.py index 11c81a8a7..5cc787492 100644 --- a/google/cloud/compute_v1/services/routers/transports/base.py +++ b/google/cloud/compute_v1/services/routers/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/routes/transports/base.py b/google/cloud/compute_v1/services/routes/transports/base.py index 521530b01..45f2ace1c 100644 --- a/google/cloud/compute_v1/services/routes/transports/base.py +++ b/google/cloud/compute_v1/services/routes/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/security_policies/transports/base.py b/google/cloud/compute_v1/services/security_policies/transports/base.py index 4b4a7d916..0af239462 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/base.py +++ b/google/cloud/compute_v1/services/security_policies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/snapshots/transports/base.py b/google/cloud/compute_v1/services/snapshots/transports/base.py index d3981daf1..5d4cd9bd1 100644 --- a/google/cloud/compute_v1/services/snapshots/transports/base.py +++ b/google/cloud/compute_v1/services/snapshots/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py index 9012f2be6..afab04794 100644 --- a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/ssl_policies/transports/base.py b/google/cloud/compute_v1/services/ssl_policies/transports/base.py index d50542c46..665fd4402 100644 --- a/google/cloud/compute_v1/services/ssl_policies/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_policies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/subnetworks/transports/base.py b/google/cloud/compute_v1/services/subnetworks/transports/base.py index 62c836563..2b997e83b 100644 --- a/google/cloud/compute_v1/services/subnetworks/transports/base.py +++ b/google/cloud/compute_v1/services/subnetworks/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py index 215c7f87f..75490a51a 100644 --- a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py index dd4c72f5c..63759170c 100644 --- a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py index b61aa7ea7..7d4e510f4 100644 --- a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_instances/transports/base.py b/google/cloud/compute_v1/services/target_instances/transports/base.py index f8ac05a91..0b2ff2ffe 100644 --- a/google/cloud/compute_v1/services/target_instances/transports/base.py +++ b/google/cloud/compute_v1/services/target_instances/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_pools/transports/base.py b/google/cloud/compute_v1/services/target_pools/transports/base.py index b52bab2b2..1ca641160 100644 --- a/google/cloud/compute_v1/services/target_pools/transports/base.py +++ b/google/cloud/compute_v1/services/target_pools/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py index 915977f48..c01efacc6 100644 --- a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py index fd2e5de69..9875effdd 100644 --- a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py index 0891f62b6..a83ce829a 100644 --- a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/url_maps/transports/base.py b/google/cloud/compute_v1/services/url_maps/transports/base.py index 7bc812c6a..beda678b7 100644 --- a/google/cloud/compute_v1/services/url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/url_maps/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py index 0c5df8dc6..2fc5141c5 100644 --- a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py index b741537d4..4ace00595 100644 --- a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/zone_operations/transports/base.py b/google/cloud/compute_v1/services/zone_operations/transports/base.py index 2cadcbf5a..a52d217f6 100644 --- a/google/cloud/compute_v1/services/zone_operations/transports/base.py +++ b/google/cloud/compute_v1/services/zone_operations/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -66,6 +67,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -89,6 +91,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -117,6 +121,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/google/cloud/compute_v1/services/zones/transports/base.py b/google/cloud/compute_v1/services/zones/transports/base.py index e9a50e5f1..da15c9c13 100644 --- a/google/cloud/compute_v1/services/zones/transports/base.py +++ b/google/cloud/compute_v1/services/zones/transports/base.py @@ -25,6 +25,7 @@ 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 from google.cloud.compute_v1.types import compute @@ -67,6 +68,7 @@ def __init__( scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, **kwargs, ) -> None: """Instantiate the transport. @@ -90,6 +92,8 @@ def __init__( 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. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: @@ -118,6 +122,14 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) + # If the credentials is service account credentials, then always try to use self signed JWT. + if ( + always_use_jwt_access + and isinstance(credentials, service_account.Credentials) + and hasattr(service_account.Credentials, "with_always_use_jwt_access") + ): + credentials = credentials.with_always_use_jwt_access(True) + # Save the credentials. self._credentials = credentials diff --git a/synth.metadata b/synth.metadata index 06ab16328..5228e7110 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-compute.git", - "sha": "40afb333a963717853f70410a7a08eda5492418c" + "sha": "fbc1a2869932883d0e7e8e498e16d2273fb25048" } }, { "git": { "name": "googleapis-discovery", "remote": "https://github.com/googleapis/googleapis-discovery.git", - "sha": "6b01eb5607e6ba0b3b931905bd779b28dc89b933" + "sha": "6a189a8bada35e2657a67b903cad7fee649f2dbc" } } ], diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index ac74df7e8..c65379315 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -118,6 +118,16 @@ def test_accelerator_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [AcceleratorTypesClient,]) +def test_accelerator_types_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [AcceleratorTypesClient,]) def test_accelerator_types_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index cefe5c688..328166f78 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -112,6 +112,16 @@ def test_addresses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [AddressesClient,]) +def test_addresses_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [AddressesClient,]) def test_addresses_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index 736d95d15..160267976 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -114,6 +114,16 @@ def test_autoscalers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [AutoscalersClient,]) +def test_autoscalers_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [AutoscalersClient,]) def test_autoscalers_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index 986f8da5b..1534aefa3 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -117,6 +117,16 @@ def test_backend_buckets_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [BackendBucketsClient,]) +def test_backend_buckets_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [BackendBucketsClient,]) def test_backend_buckets_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index 991770dd5..5138b0293 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -117,6 +117,16 @@ def test_backend_services_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [BackendServicesClient,]) +def test_backend_services_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [BackendServicesClient,]) def test_backend_services_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index 47bf9fdd7..46b9e769f 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -112,6 +112,16 @@ def test_disk_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [DiskTypesClient,]) +def test_disk_types_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [DiskTypesClient,]) def test_disk_types_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index e55b37af8..6d1eb5d9f 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -109,6 +109,16 @@ def test_disks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [DisksClient,]) +def test_disks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [DisksClient,]) def test_disks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index e3fcde065..678bb7231 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -120,6 +120,16 @@ def test_external_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ExternalVpnGatewaysClient,]) +def test_external_vpn_gateways_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ExternalVpnGatewaysClient,]) def test_external_vpn_gateways_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index 9edef8eda..58f52021c 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -118,6 +118,16 @@ def test_firewall_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [FirewallPoliciesClient,]) +def test_firewall_policies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [FirewallPoliciesClient,]) def test_firewall_policies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index de0fde737..10044c8dd 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -112,6 +112,16 @@ def test_firewalls_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [FirewallsClient,]) +def test_firewalls_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [FirewallsClient,]) def test_firewalls_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 2995c60a6..5437aa2ab 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -117,6 +117,16 @@ def test_forwarding_rules_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ForwardingRulesClient,]) +def test_forwarding_rules_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ForwardingRulesClient,]) def test_forwarding_rules_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index fdbe7fd06..69c70bed1 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -117,6 +117,16 @@ def test_global_addresses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalAddressesClient,]) +def test_global_addresses_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalAddressesClient,]) def test_global_addresses_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index 333ea1017..fd582859f 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -120,6 +120,16 @@ def test_global_forwarding_rules_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalForwardingRulesClient,]) +def test_global_forwarding_rules_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalForwardingRulesClient,]) def test_global_forwarding_rules_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 5694a714b..5cd6a18f2 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -122,6 +122,18 @@ def test_global_network_endpoint_groups_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalNetworkEndpointGroupsClient,]) +def test_global_network_endpoint_groups_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalNetworkEndpointGroupsClient,]) def test_global_network_endpoint_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index c08bc4fac..089ab4ee4 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -118,6 +118,16 @@ def test_global_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalOperationsClient,]) +def test_global_operations_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalOperationsClient,]) def test_global_operations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 4be3bd2e8..70c49eced 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -122,6 +122,18 @@ def test_global_organization_operations_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalOrganizationOperationsClient,]) +def test_global_organization_operations_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalOrganizationOperationsClient,]) def test_global_organization_operations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index 40f05db55..c17c75813 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -126,6 +126,18 @@ def test_global_public_delegated_prefixes_client_from_service_account_info( assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [GlobalPublicDelegatedPrefixesClient,]) +def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [GlobalPublicDelegatedPrefixesClient,]) def test_global_public_delegated_prefixes_client_from_service_account_file( client_class, diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index 717aa23e3..251c4e1a7 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -114,6 +114,16 @@ def test_health_checks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [HealthChecksClient,]) +def test_health_checks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [HealthChecksClient,]) def test_health_checks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index 2b1393a4d..45937053c 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -109,6 +109,16 @@ def test_images_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ImagesClient,]) +def test_images_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ImagesClient,]) def test_images_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index 03427414b..8e5bf87b5 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -120,6 +120,16 @@ def test_instance_group_managers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InstanceGroupManagersClient,]) +def test_instance_group_managers_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InstanceGroupManagersClient,]) def test_instance_group_managers_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index ea9d87d46..68e2330d4 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -117,6 +117,16 @@ def test_instance_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InstanceGroupsClient,]) +def test_instance_groups_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InstanceGroupsClient,]) def test_instance_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index f751a07d4..5765c5b37 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -118,6 +118,16 @@ def test_instance_templates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InstanceTemplatesClient,]) +def test_instance_templates_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InstanceTemplatesClient,]) def test_instance_templates_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index 8800d3fe0..28cb7cf24 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -112,6 +112,16 @@ def test_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InstancesClient,]) +def test_instances_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InstancesClient,]) def test_instances_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 9154a4d03..89c6a2167 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -120,6 +120,16 @@ def test_interconnect_attachments_client_from_service_account_info(client_class) assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InterconnectAttachmentsClient,]) +def test_interconnect_attachments_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InterconnectAttachmentsClient,]) def test_interconnect_attachments_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index d2c4d1381..731552395 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -120,6 +120,16 @@ def test_interconnect_locations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InterconnectLocationsClient,]) +def test_interconnect_locations_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InterconnectLocationsClient,]) def test_interconnect_locations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index d694e3f79..935261983 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -117,6 +117,16 @@ def test_interconnects_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [InterconnectsClient,]) +def test_interconnects_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [InterconnectsClient,]) def test_interconnects_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index bb88f4b76..6502cb5c8 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -113,6 +113,16 @@ def test_license_codes_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [LicenseCodesClient,]) +def test_license_codes_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [LicenseCodesClient,]) def test_license_codes_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index 50ad26ff1..ea0add277 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -112,6 +112,16 @@ def test_licenses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [LicensesClient,]) +def test_licenses_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [LicensesClient,]) def test_licenses_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index bd7232bf8..7834d283a 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -114,6 +114,16 @@ def test_machine_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [MachineTypesClient,]) +def test_machine_types_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [MachineTypesClient,]) def test_machine_types_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index b02392cab..ec8cc9488 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -120,6 +120,16 @@ def test_network_endpoint_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [NetworkEndpointGroupsClient,]) +def test_network_endpoint_groups_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [NetworkEndpointGroupsClient,]) def test_network_endpoint_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 2c71147e5..27204e6d3 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -112,6 +112,16 @@ def test_networks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [NetworksClient,]) +def test_networks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [NetworksClient,]) def test_networks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index f085711e3..6fbd90776 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -114,6 +114,16 @@ def test_node_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [NodeGroupsClient,]) +def test_node_groups_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [NodeGroupsClient,]) def test_node_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index 8b0ad9201..0a762bcbd 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -117,6 +117,16 @@ def test_node_templates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [NodeTemplatesClient,]) +def test_node_templates_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [NodeTemplatesClient,]) def test_node_templates_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index 575856b68..b6cbd36c6 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -112,6 +112,16 @@ def test_node_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [NodeTypesClient,]) +def test_node_types_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [NodeTypesClient,]) def test_node_types_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 4f459cc8b..604de28ce 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -118,6 +118,16 @@ def test_packet_mirrorings_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [PacketMirroringsClient,]) +def test_packet_mirrorings_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [PacketMirroringsClient,]) def test_packet_mirrorings_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index 913e8ffb9..9fd6c440f 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -112,6 +112,16 @@ def test_projects_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ProjectsClient,]) +def test_projects_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ProjectsClient,]) def test_projects_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index e1330fc06..56224c11c 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -120,6 +120,16 @@ def test_public_advertised_prefixes_client_from_service_account_info(client_clas assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [PublicAdvertisedPrefixesClient,]) +def test_public_advertised_prefixes_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [PublicAdvertisedPrefixesClient,]) def test_public_advertised_prefixes_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index 665f7ac29..62d518db6 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -120,6 +120,16 @@ def test_public_delegated_prefixes_client_from_service_account_info(client_class assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [PublicDelegatedPrefixesClient,]) +def test_public_delegated_prefixes_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [PublicDelegatedPrefixesClient,]) def test_public_delegated_prefixes_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 9bcec6b41..36812b502 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -118,6 +118,16 @@ def test_region_autoscalers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionAutoscalersClient,]) +def test_region_autoscalers_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionAutoscalersClient,]) def test_region_autoscalers_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index dd5bb80e6..8b2a6dd4e 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -120,6 +120,16 @@ def test_region_backend_services_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionBackendServicesClient,]) +def test_region_backend_services_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionBackendServicesClient,]) def test_region_backend_services_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 9cd8457a5..853d49b74 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -118,6 +118,16 @@ def test_region_commitments_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionCommitmentsClient,]) +def test_region_commitments_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionCommitmentsClient,]) def test_region_commitments_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index 456fb5c8d..6686f0d1a 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -117,6 +117,16 @@ def test_region_disk_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionDiskTypesClient,]) +def test_region_disk_types_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionDiskTypesClient,]) def test_region_disk_types_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index 1d0cebbb1..6ea10fe39 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -114,6 +114,16 @@ def test_region_disks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionDisksClient,]) +def test_region_disks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionDisksClient,]) def test_region_disks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index 40d7ad53c..af9d97f20 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -122,6 +122,18 @@ def test_region_health_check_services_client_from_service_account_info(client_cl assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionHealthCheckServicesClient,]) +def test_region_health_check_services_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionHealthCheckServicesClient,]) def test_region_health_check_services_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index 4d1eb1d5b..a7ed0e491 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -120,6 +120,16 @@ def test_region_health_checks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionHealthChecksClient,]) +def test_region_health_checks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionHealthChecksClient,]) def test_region_health_checks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index f9c68594c..614a6ef84 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -122,6 +122,18 @@ def test_region_instance_group_managers_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionInstanceGroupManagersClient,]) +def test_region_instance_group_managers_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionInstanceGroupManagersClient,]) def test_region_instance_group_managers_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 54b92c473..373304bf6 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -120,6 +120,16 @@ def test_region_instance_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionInstanceGroupsClient,]) +def test_region_instance_groups_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionInstanceGroupsClient,]) def test_region_instance_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index e38868e10..d3bc13d84 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -116,6 +116,16 @@ def test_region_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionInstancesClient,]) +def test_region_instances_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionInstancesClient,]) def test_region_instances_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index 099f677e4..e72ea3311 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -122,6 +122,18 @@ def test_region_network_endpoint_groups_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionNetworkEndpointGroupsClient,]) +def test_region_network_endpoint_groups_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionNetworkEndpointGroupsClient,]) def test_region_network_endpoint_groups_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 8719081af..12f433490 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -122,6 +122,18 @@ def test_region_notification_endpoints_client_from_service_account_info(client_c assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionNotificationEndpointsClient,]) +def test_region_notification_endpoints_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionNotificationEndpointsClient,]) def test_region_notification_endpoints_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index 94ca3699c..489ed6f30 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -118,6 +118,16 @@ def test_region_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionOperationsClient,]) +def test_region_operations_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionOperationsClient,]) def test_region_operations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index a869abde5..9197b9b30 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -120,6 +120,16 @@ def test_region_ssl_certificates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionSslCertificatesClient,]) +def test_region_ssl_certificates_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionSslCertificatesClient,]) def test_region_ssl_certificates_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index a5d92bff5..47df1f079 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -120,6 +120,16 @@ def test_region_target_http_proxies_client_from_service_account_info(client_clas assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionTargetHttpProxiesClient,]) +def test_region_target_http_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionTargetHttpProxiesClient,]) def test_region_target_http_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index d926deebd..53978f7b4 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -120,6 +120,18 @@ def test_region_target_https_proxies_client_from_service_account_info(client_cla assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionTargetHttpsProxiesClient,]) +def test_region_target_https_proxies_client_service_account_always_use_jwt( + client_class, +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionTargetHttpsProxiesClient,]) def test_region_target_https_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index 6aa557a59..a6f314565 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -117,6 +117,16 @@ def test_region_url_maps_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionUrlMapsClient,]) +def test_region_url_maps_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionUrlMapsClient,]) def test_region_url_maps_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index dd53a7bf2..6b7151b58 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -111,6 +111,16 @@ def test_regions_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RegionsClient,]) +def test_regions_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RegionsClient,]) def test_regions_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index b207a87a6..8a6c9433f 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -114,6 +114,16 @@ def test_reservations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ReservationsClient,]) +def test_reservations_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ReservationsClient,]) def test_reservations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index 05b8ed4c3..7bab7a43b 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -118,6 +118,16 @@ def test_resource_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ResourcePoliciesClient,]) +def test_resource_policies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ResourcePoliciesClient,]) def test_resource_policies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index 9d215ccd0..0c629e8c2 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -111,6 +111,16 @@ def test_routers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RoutersClient,]) +def test_routers_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RoutersClient,]) def test_routers_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 98571a88b..9f24d25e2 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -109,6 +109,16 @@ def test_routes_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [RoutesClient,]) +def test_routes_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [RoutesClient,]) def test_routes_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index 620812004..e27db9c3d 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -118,6 +118,16 @@ def test_security_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [SecurityPoliciesClient,]) +def test_security_policies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [SecurityPoliciesClient,]) def test_security_policies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index 7cf38a538..f46ec71e8 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -112,6 +112,16 @@ def test_snapshots_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [SnapshotsClient,]) +def test_snapshots_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [SnapshotsClient,]) def test_snapshots_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index 08064f887..704667755 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -117,6 +117,16 @@ def test_ssl_certificates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [SslCertificatesClient,]) +def test_ssl_certificates_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [SslCertificatesClient,]) def test_ssl_certificates_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index 08844d4ba..b410c694d 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -114,6 +114,16 @@ def test_ssl_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [SslPoliciesClient,]) +def test_ssl_policies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [SslPoliciesClient,]) def test_ssl_policies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index 4ac9a4175..07dcd71fd 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -114,6 +114,16 @@ def test_subnetworks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [SubnetworksClient,]) +def test_subnetworks_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [SubnetworksClient,]) def test_subnetworks_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index 8f313530e..d4ad0894b 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -118,6 +118,16 @@ def test_target_grpc_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetGrpcProxiesClient,]) +def test_target_grpc_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetGrpcProxiesClient,]) def test_target_grpc_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 81575216d..5880f4b71 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -118,6 +118,16 @@ def test_target_http_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetHttpProxiesClient,]) +def test_target_http_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetHttpProxiesClient,]) def test_target_http_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index 07c0591de..c1b092ae9 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -120,6 +120,16 @@ def test_target_https_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetHttpsProxiesClient,]) +def test_target_https_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetHttpsProxiesClient,]) def test_target_https_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index a2b6fd1ba..91aba31aa 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -117,6 +117,16 @@ def test_target_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetInstancesClient,]) +def test_target_instances_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetInstancesClient,]) def test_target_instances_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index 7a5254ad5..da9d7acc2 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -114,6 +114,16 @@ def test_target_pools_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetPoolsClient,]) +def test_target_pools_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetPoolsClient,]) def test_target_pools_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index aa4a5ec16..95f69b6a5 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -118,6 +118,16 @@ def test_target_ssl_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetSslProxiesClient,]) +def test_target_ssl_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetSslProxiesClient,]) def test_target_ssl_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index 0b5da0d8b..d08cfe6c0 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -118,6 +118,16 @@ def test_target_tcp_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetTcpProxiesClient,]) +def test_target_tcp_proxies_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetTcpProxiesClient,]) def test_target_tcp_proxies_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index d04398cae..fb2e300d3 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -118,6 +118,16 @@ def test_target_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [TargetVpnGatewaysClient,]) +def test_target_vpn_gateways_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [TargetVpnGatewaysClient,]) def test_target_vpn_gateways_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index 1cc472f9c..01162e6dc 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -111,6 +111,16 @@ def test_url_maps_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [UrlMapsClient,]) +def test_url_maps_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [UrlMapsClient,]) def test_url_maps_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index 05b241ad4..ea2072096 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -114,6 +114,16 @@ def test_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [VpnGatewaysClient,]) +def test_vpn_gateways_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [VpnGatewaysClient,]) def test_vpn_gateways_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index 1e8687427..4dbc30c0d 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -114,6 +114,16 @@ def test_vpn_tunnels_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [VpnTunnelsClient,]) +def test_vpn_tunnels_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [VpnTunnelsClient,]) def test_vpn_tunnels_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index d37181c35..e8e13b6ac 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -117,6 +117,16 @@ def test_zone_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ZoneOperationsClient,]) +def test_zone_operations_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ZoneOperationsClient,]) def test_zone_operations_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 9f513c918..87665bb2a 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -109,6 +109,16 @@ def test_zones_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" +@pytest.mark.parametrize("client_class", [ZonesClient,]) +def test_zones_client_service_account_always_use_jwt(client_class): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + client = client_class(credentials=creds) + use_jwt.assert_called_with(True) + + @pytest.mark.parametrize("client_class", [ZonesClient,]) def test_zones_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() From 229d59f845c662df0df8c1e3f081f8c42d2de66e Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 5 Aug 2021 23:08:09 +0000 Subject: [PATCH 2/5] chore!: Migrate to gapic-generator-java, remove monolith dependency Source-Author: Vadym Matsishevskyi <25311427+vam-google@users.noreply.github.com> Source-Date: Wed Jun 30 10:37:13 2021 -0700 Source-Repo: googleapis/googleapis-discovery Source-Sha: abf4cec1ce9e02e4d7d650bf66137c347cdd0d44 Source-Link: https://github.com/googleapis/googleapis-discovery/commit/abf4cec1ce9e02e4d7d650bf66137c347cdd0d44 --- .../accelerator_types/transports/base.py | 2 +- .../services/addresses/transports/base.py | 2 +- .../services/autoscalers/transports/base.py | 2 +- .../services/backend_buckets/transports/base.py | 2 +- .../backend_services/transports/base.py | 2 +- .../services/disk_types/transports/base.py | 2 +- .../services/disks/transports/base.py | 2 +- .../external_vpn_gateways/transports/base.py | 2 +- .../firewall_policies/transports/base.py | 2 +- .../services/firewalls/transports/base.py | 2 +- .../forwarding_rules/transports/base.py | 2 +- .../global_addresses/transports/base.py | 2 +- .../global_forwarding_rules/transports/base.py | 2 +- .../transports/base.py | 2 +- .../global_operations/transports/base.py | 2 +- .../transports/base.py | 2 +- .../transports/base.py | 2 +- .../services/health_checks/transports/base.py | 2 +- .../services/images/transports/base.py | 2 +- .../instance_group_managers/transports/base.py | 2 +- .../services/instance_groups/transports/base.py | 2 +- .../instance_templates/transports/base.py | 2 +- .../services/instances/transports/base.py | 2 +- .../interconnect_attachments/transports/base.py | 2 +- .../interconnect_locations/transports/base.py | 2 +- .../services/interconnects/transports/base.py | 2 +- .../services/license_codes/transports/base.py | 2 +- .../services/licenses/transports/base.py | 2 +- .../services/machine_types/transports/base.py | 2 +- .../network_endpoint_groups/transports/base.py | 2 +- .../services/networks/transports/base.py | 2 +- .../services/node_groups/transports/base.py | 2 +- .../services/node_templates/transports/base.py | 2 +- .../services/node_types/transports/base.py | 2 +- .../packet_mirrorings/transports/base.py | 2 +- .../services/projects/transports/base.py | 2 +- .../transports/base.py | 2 +- .../transports/base.py | 2 +- .../region_autoscalers/transports/base.py | 2 +- .../region_backend_services/transports/base.py | 2 +- .../region_commitments/transports/base.py | 2 +- .../region_disk_types/transports/base.py | 2 +- .../services/region_disks/transports/base.py | 2 +- .../transports/base.py | 2 +- .../region_health_checks/transports/base.py | 2 +- .../transports/base.py | 2 +- .../region_instance_groups/transports/base.py | 2 +- .../region_instances/transports/base.py | 2 +- .../transports/base.py | 2 +- .../transports/base.py | 2 +- .../region_operations/transports/base.py | 2 +- .../region_ssl_certificates/transports/base.py | 2 +- .../transports/base.py | 2 +- .../transports/base.py | 2 +- .../services/region_url_maps/transports/base.py | 2 +- .../services/regions/transports/base.py | 2 +- .../services/reservations/transports/base.py | 2 +- .../resource_policies/transports/base.py | 2 +- .../services/routers/transports/base.py | 2 +- .../services/routes/transports/base.py | 2 +- .../security_policies/transports/base.py | 2 +- .../services/snapshots/transports/base.py | 2 +- .../ssl_certificates/transports/base.py | 2 +- .../services/ssl_policies/transports/base.py | 2 +- .../services/subnetworks/transports/base.py | 2 +- .../target_grpc_proxies/transports/base.py | 2 +- .../target_http_proxies/transports/base.py | 2 +- .../target_https_proxies/transports/base.py | 2 +- .../target_instances/transports/base.py | 2 +- .../services/target_pools/transports/base.py | 2 +- .../target_ssl_proxies/transports/base.py | 2 +- .../target_tcp_proxies/transports/base.py | 2 +- .../target_vpn_gateways/transports/base.py | 2 +- .../services/url_maps/transports/base.py | 2 +- .../services/vpn_gateways/transports/base.py | 2 +- .../services/vpn_tunnels/transports/base.py | 2 +- .../services/zone_operations/transports/base.py | 2 +- .../services/zones/transports/base.py | 2 +- synth.metadata | 2 +- .../gapic/compute_v1/test_accelerator_types.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_addresses.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_autoscalers.py | 16 +++++++++++++++- .../gapic/compute_v1/test_backend_buckets.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_backend_services.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_disk_types.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_disks.py | 16 +++++++++++++++- .../compute_v1/test_external_vpn_gateways.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_firewall_policies.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_firewalls.py | 16 +++++++++++++++- .../gapic/compute_v1/test_forwarding_rules.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_global_addresses.py | 17 ++++++++++++++++- .../compute_v1/test_global_forwarding_rules.py | 17 ++++++++++++++++- .../test_global_network_endpoint_groups.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_global_operations.py | 17 ++++++++++++++++- .../test_global_organization_operations.py | 17 ++++++++++++++++- .../test_global_public_delegated_prefixes.py | 17 ++++++++++++++++- .../unit/gapic/compute_v1/test_health_checks.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_images.py | 16 +++++++++++++++- .../compute_v1/test_instance_group_managers.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_instance_groups.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_instance_templates.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_instances.py | 16 +++++++++++++++- .../compute_v1/test_interconnect_attachments.py | 17 ++++++++++++++++- .../compute_v1/test_interconnect_locations.py | 17 ++++++++++++++++- .../unit/gapic/compute_v1/test_interconnects.py | 16 +++++++++++++++- .../unit/gapic/compute_v1/test_license_codes.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_licenses.py | 16 +++++++++++++++- .../unit/gapic/compute_v1/test_machine_types.py | 16 +++++++++++++++- .../compute_v1/test_network_endpoint_groups.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_networks.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_node_groups.py | 16 +++++++++++++++- .../gapic/compute_v1/test_node_templates.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_node_types.py | 16 +++++++++++++++- .../gapic/compute_v1/test_packet_mirrorings.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_projects.py | 16 +++++++++++++++- .../test_public_advertised_prefixes.py | 17 ++++++++++++++++- .../test_public_delegated_prefixes.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_autoscalers.py | 17 ++++++++++++++++- .../compute_v1/test_region_backend_services.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_commitments.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_disk_types.py | 17 ++++++++++++++++- .../unit/gapic/compute_v1/test_region_disks.py | 16 +++++++++++++++- .../test_region_health_check_services.py | 17 ++++++++++++++++- .../compute_v1/test_region_health_checks.py | 17 ++++++++++++++++- .../test_region_instance_group_managers.py | 17 ++++++++++++++++- .../compute_v1/test_region_instance_groups.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_instances.py | 17 ++++++++++++++++- .../test_region_network_endpoint_groups.py | 17 ++++++++++++++++- .../test_region_notification_endpoints.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_operations.py | 17 ++++++++++++++++- .../compute_v1/test_region_ssl_certificates.py | 17 ++++++++++++++++- .../test_region_target_http_proxies.py | 17 ++++++++++++++++- .../test_region_target_https_proxies.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_region_url_maps.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_regions.py | 16 +++++++++++++++- .../unit/gapic/compute_v1/test_reservations.py | 16 +++++++++++++++- .../gapic/compute_v1/test_resource_policies.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_routers.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_routes.py | 16 +++++++++++++++- .../gapic/compute_v1/test_security_policies.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_snapshots.py | 16 +++++++++++++++- .../gapic/compute_v1/test_ssl_certificates.py | 17 ++++++++++++++++- .../unit/gapic/compute_v1/test_ssl_policies.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_subnetworks.py | 16 +++++++++++++++- .../compute_v1/test_target_grpc_proxies.py | 17 ++++++++++++++++- .../compute_v1/test_target_http_proxies.py | 17 ++++++++++++++++- .../compute_v1/test_target_https_proxies.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_target_instances.py | 17 ++++++++++++++++- .../unit/gapic/compute_v1/test_target_pools.py | 16 +++++++++++++++- .../gapic/compute_v1/test_target_ssl_proxies.py | 17 ++++++++++++++++- .../gapic/compute_v1/test_target_tcp_proxies.py | 17 ++++++++++++++++- .../compute_v1/test_target_vpn_gateways.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_url_maps.py | 16 +++++++++++++++- .../unit/gapic/compute_v1/test_vpn_gateways.py | 16 +++++++++++++++- tests/unit/gapic/compute_v1/test_vpn_tunnels.py | 16 +++++++++++++++- .../gapic/compute_v1/test_zone_operations.py | 17 ++++++++++++++++- tests/unit/gapic/compute_v1/test_zones.py | 16 +++++++++++++++- 157 files changed, 1296 insertions(+), 157 deletions(-) diff --git a/google/cloud/compute_v1/services/accelerator_types/transports/base.py b/google/cloud/compute_v1/services/accelerator_types/transports/base.py index b4366b11c..08226272e 100644 --- a/google/cloud/compute_v1/services/accelerator_types/transports/base.py +++ b/google/cloud/compute_v1/services/accelerator_types/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/addresses/transports/base.py b/google/cloud/compute_v1/services/addresses/transports/base.py index 093fd33cf..5cdfc8801 100644 --- a/google/cloud/compute_v1/services/addresses/transports/base.py +++ b/google/cloud/compute_v1/services/addresses/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/autoscalers/transports/base.py b/google/cloud/compute_v1/services/autoscalers/transports/base.py index 73aa2d209..d9fed1df4 100644 --- a/google/cloud/compute_v1/services/autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/autoscalers/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/backend_buckets/transports/base.py b/google/cloud/compute_v1/services/backend_buckets/transports/base.py index 929eb3507..9ea956822 100644 --- a/google/cloud/compute_v1/services/backend_buckets/transports/base.py +++ b/google/cloud/compute_v1/services/backend_buckets/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/backend_services/transports/base.py b/google/cloud/compute_v1/services/backend_services/transports/base.py index 3067603cf..ad5073c95 100644 --- a/google/cloud/compute_v1/services/backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/backend_services/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/disk_types/transports/base.py b/google/cloud/compute_v1/services/disk_types/transports/base.py index 16b858cc1..435a8f2a6 100644 --- a/google/cloud/compute_v1/services/disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/disk_types/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/disks/transports/base.py b/google/cloud/compute_v1/services/disks/transports/base.py index 0ad9e2cab..f089ac23e 100644 --- a/google/cloud/compute_v1/services/disks/transports/base.py +++ b/google/cloud/compute_v1/services/disks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py index 3ea65043f..b7b5e8a61 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/firewall_policies/transports/base.py b/google/cloud/compute_v1/services/firewall_policies/transports/base.py index 0b6d41da9..44b407fc5 100644 --- a/google/cloud/compute_v1/services/firewall_policies/transports/base.py +++ b/google/cloud/compute_v1/services/firewall_policies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/firewalls/transports/base.py b/google/cloud/compute_v1/services/firewalls/transports/base.py index 0905823fd..b57a2648b 100644 --- a/google/cloud/compute_v1/services/firewalls/transports/base.py +++ b/google/cloud/compute_v1/services/firewalls/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py index 5127bbe7f..f8af0c13a 100644 --- a/google/cloud/compute_v1/services/forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/forwarding_rules/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_addresses/transports/base.py b/google/cloud/compute_v1/services/global_addresses/transports/base.py index 37dc347cf..d380c32be 100644 --- a/google/cloud/compute_v1/services/global_addresses/transports/base.py +++ b/google/cloud/compute_v1/services/global_addresses/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py index 97156c55e..e61272413 100644 --- a/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py +++ b/google/cloud/compute_v1/services/global_forwarding_rules/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py index 7ffeb20bd..70115faff 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_operations/transports/base.py b/google/cloud/compute_v1/services/global_operations/transports/base.py index e092e53df..ad8a387a5 100644 --- a/google/cloud/compute_v1/services/global_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_operations/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py index a926ecf00..761c77b4b 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/transports/base.py +++ b/google/cloud/compute_v1/services/global_organization_operations/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py index 921b53d29..254740127 100644 --- a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/health_checks/transports/base.py b/google/cloud/compute_v1/services/health_checks/transports/base.py index fa925f200..d6806e2b1 100644 --- a/google/cloud/compute_v1/services/health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/health_checks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/images/transports/base.py b/google/cloud/compute_v1/services/images/transports/base.py index c71196d3a..eeb769956 100644 --- a/google/cloud/compute_v1/services/images/transports/base.py +++ b/google/cloud/compute_v1/services/images/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py index c0c516b4a..d2868d78e 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/instance_group_managers/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/instance_groups/transports/base.py b/google/cloud/compute_v1/services/instance_groups/transports/base.py index 90133594b..3a7c9f07d 100644 --- a/google/cloud/compute_v1/services/instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/instance_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/instance_templates/transports/base.py b/google/cloud/compute_v1/services/instance_templates/transports/base.py index d71f8df84..243a5e981 100644 --- a/google/cloud/compute_v1/services/instance_templates/transports/base.py +++ b/google/cloud/compute_v1/services/instance_templates/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/instances/transports/base.py b/google/cloud/compute_v1/services/instances/transports/base.py index 877b77616..d5158fc8a 100644 --- a/google/cloud/compute_v1/services/instances/transports/base.py +++ b/google/cloud/compute_v1/services/instances/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py index 68e36ccf5..baae3e9ad 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py index 85a50f525..16f563fae 100644 --- a/google/cloud/compute_v1/services/interconnect_locations/transports/base.py +++ b/google/cloud/compute_v1/services/interconnect_locations/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/interconnects/transports/base.py b/google/cloud/compute_v1/services/interconnects/transports/base.py index ffca672b2..3cafc0f82 100644 --- a/google/cloud/compute_v1/services/interconnects/transports/base.py +++ b/google/cloud/compute_v1/services/interconnects/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/license_codes/transports/base.py b/google/cloud/compute_v1/services/license_codes/transports/base.py index ebfaeff82..1a5800749 100644 --- a/google/cloud/compute_v1/services/license_codes/transports/base.py +++ b/google/cloud/compute_v1/services/license_codes/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/licenses/transports/base.py b/google/cloud/compute_v1/services/licenses/transports/base.py index 7948a3cfe..e0c15a542 100644 --- a/google/cloud/compute_v1/services/licenses/transports/base.py +++ b/google/cloud/compute_v1/services/licenses/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/machine_types/transports/base.py b/google/cloud/compute_v1/services/machine_types/transports/base.py index 67325ee16..af7b3f966 100644 --- a/google/cloud/compute_v1/services/machine_types/transports/base.py +++ b/google/cloud/compute_v1/services/machine_types/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py index cce98b100..30d8036b0 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/networks/transports/base.py b/google/cloud/compute_v1/services/networks/transports/base.py index 33fd4828e..e10e936be 100644 --- a/google/cloud/compute_v1/services/networks/transports/base.py +++ b/google/cloud/compute_v1/services/networks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/node_groups/transports/base.py b/google/cloud/compute_v1/services/node_groups/transports/base.py index f918842ea..eedf04e8b 100644 --- a/google/cloud/compute_v1/services/node_groups/transports/base.py +++ b/google/cloud/compute_v1/services/node_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/node_templates/transports/base.py b/google/cloud/compute_v1/services/node_templates/transports/base.py index bce68a5a0..b53218c1d 100644 --- a/google/cloud/compute_v1/services/node_templates/transports/base.py +++ b/google/cloud/compute_v1/services/node_templates/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/node_types/transports/base.py b/google/cloud/compute_v1/services/node_types/transports/base.py index 7f692ba40..f82cea712 100644 --- a/google/cloud/compute_v1/services/node_types/transports/base.py +++ b/google/cloud/compute_v1/services/node_types/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py index cceb1b53b..c4534cede 100644 --- a/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py +++ b/google/cloud/compute_v1/services/packet_mirrorings/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/projects/transports/base.py b/google/cloud/compute_v1/services/projects/transports/base.py index 2a448cf29..e3960b084 100644 --- a/google/cloud/compute_v1/services/projects/transports/base.py +++ b/google/cloud/compute_v1/services/projects/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py index f736429d5..69ff5553d 100644 --- a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py index 1dc41b672..df0d122fc 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py index 3bbd2ecd9..b5ff9e4b5 100644 --- a/google/cloud/compute_v1/services/region_autoscalers/transports/base.py +++ b/google/cloud/compute_v1/services/region_autoscalers/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_backend_services/transports/base.py b/google/cloud/compute_v1/services/region_backend_services/transports/base.py index f8afc7289..654d4530e 100644 --- a/google/cloud/compute_v1/services/region_backend_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_backend_services/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_commitments/transports/base.py b/google/cloud/compute_v1/services/region_commitments/transports/base.py index 849e5e64d..33cf045d1 100644 --- a/google/cloud/compute_v1/services/region_commitments/transports/base.py +++ b/google/cloud/compute_v1/services/region_commitments/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_disk_types/transports/base.py b/google/cloud/compute_v1/services/region_disk_types/transports/base.py index 0f609bcf6..c34ec1dd7 100644 --- a/google/cloud/compute_v1/services/region_disk_types/transports/base.py +++ b/google/cloud/compute_v1/services/region_disk_types/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_disks/transports/base.py b/google/cloud/compute_v1/services/region_disks/transports/base.py index 9a8d57cb4..a9776d689 100644 --- a/google/cloud/compute_v1/services/region_disks/transports/base.py +++ b/google/cloud/compute_v1/services/region_disks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py index 2c976b214..1217f3ece 100644 --- a/google/cloud/compute_v1/services/region_health_check_services/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_check_services/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_health_checks/transports/base.py b/google/cloud/compute_v1/services/region_health_checks/transports/base.py index 808f03eea..08473df47 100644 --- a/google/cloud/compute_v1/services/region_health_checks/transports/base.py +++ b/google/cloud/compute_v1/services/region_health_checks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py index 1e0cad0de..46ec6826c 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py index db5b274eb..0b146950e 100644 --- a/google/cloud/compute_v1/services/region_instance_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_instance_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_instances/transports/base.py b/google/cloud/compute_v1/services/region_instances/transports/base.py index 427fcf83f..3cb020b59 100644 --- a/google/cloud/compute_v1/services/region_instances/transports/base.py +++ b/google/cloud/compute_v1/services/region_instances/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py index 7e19aa1f9..29e5bef3d 100644 --- a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py +++ b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py index 581426cc1..20f7be9fc 100644 --- a/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py +++ b/google/cloud/compute_v1/services/region_notification_endpoints/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_operations/transports/base.py b/google/cloud/compute_v1/services/region_operations/transports/base.py index 8786bc3f2..494a3bc85 100644 --- a/google/cloud/compute_v1/services/region_operations/transports/base.py +++ b/google/cloud/compute_v1/services/region_operations/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py index aab82ba1f..83d627233 100644 --- a/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/region_ssl_certificates/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py index 8ccca0754..0509d04f7 100644 --- a/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_http_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py index e40df34c5..02124d004 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/region_url_maps/transports/base.py b/google/cloud/compute_v1/services/region_url_maps/transports/base.py index 90547481a..d6236858b 100644 --- a/google/cloud/compute_v1/services/region_url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/region_url_maps/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/regions/transports/base.py b/google/cloud/compute_v1/services/regions/transports/base.py index da819431a..c02266c47 100644 --- a/google/cloud/compute_v1/services/regions/transports/base.py +++ b/google/cloud/compute_v1/services/regions/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/reservations/transports/base.py b/google/cloud/compute_v1/services/reservations/transports/base.py index c4a26ffdd..83b8f4136 100644 --- a/google/cloud/compute_v1/services/reservations/transports/base.py +++ b/google/cloud/compute_v1/services/reservations/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/resource_policies/transports/base.py b/google/cloud/compute_v1/services/resource_policies/transports/base.py index 075c013fc..b4846ad70 100644 --- a/google/cloud/compute_v1/services/resource_policies/transports/base.py +++ b/google/cloud/compute_v1/services/resource_policies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/routers/transports/base.py b/google/cloud/compute_v1/services/routers/transports/base.py index 5cc787492..6d22db5e7 100644 --- a/google/cloud/compute_v1/services/routers/transports/base.py +++ b/google/cloud/compute_v1/services/routers/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/routes/transports/base.py b/google/cloud/compute_v1/services/routes/transports/base.py index 45f2ace1c..846a9396e 100644 --- a/google/cloud/compute_v1/services/routes/transports/base.py +++ b/google/cloud/compute_v1/services/routes/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/security_policies/transports/base.py b/google/cloud/compute_v1/services/security_policies/transports/base.py index 0af239462..2e6042ab3 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/base.py +++ b/google/cloud/compute_v1/services/security_policies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/snapshots/transports/base.py b/google/cloud/compute_v1/services/snapshots/transports/base.py index 5d4cd9bd1..e34d66a84 100644 --- a/google/cloud/compute_v1/services/snapshots/transports/base.py +++ b/google/cloud/compute_v1/services/snapshots/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py index afab04794..0b9d8a4ea 100644 --- a/google/cloud/compute_v1/services/ssl_certificates/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_certificates/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/ssl_policies/transports/base.py b/google/cloud/compute_v1/services/ssl_policies/transports/base.py index 665fd4402..bb586a325 100644 --- a/google/cloud/compute_v1/services/ssl_policies/transports/base.py +++ b/google/cloud/compute_v1/services/ssl_policies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/subnetworks/transports/base.py b/google/cloud/compute_v1/services/subnetworks/transports/base.py index 2b997e83b..ff3498abe 100644 --- a/google/cloud/compute_v1/services/subnetworks/transports/base.py +++ b/google/cloud/compute_v1/services/subnetworks/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py index 75490a51a..575168607 100644 --- a/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_grpc_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py index 63759170c..efb28747b 100644 --- a/google/cloud/compute_v1/services/target_http_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_http_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py index 7d4e510f4..efe301a6a 100644 --- a/google/cloud/compute_v1/services/target_https_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_https_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_instances/transports/base.py b/google/cloud/compute_v1/services/target_instances/transports/base.py index 0b2ff2ffe..3f6318c9e 100644 --- a/google/cloud/compute_v1/services/target_instances/transports/base.py +++ b/google/cloud/compute_v1/services/target_instances/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_pools/transports/base.py b/google/cloud/compute_v1/services/target_pools/transports/base.py index 1ca641160..04f55ad82 100644 --- a/google/cloud/compute_v1/services/target_pools/transports/base.py +++ b/google/cloud/compute_v1/services/target_pools/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py index c01efacc6..7ab3639a9 100644 --- a/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_ssl_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py index 9875effdd..2ac783c3a 100644 --- a/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py +++ b/google/cloud/compute_v1/services/target_tcp_proxies/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py index a83ce829a..7b33ee556 100644 --- a/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/target_vpn_gateways/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/url_maps/transports/base.py b/google/cloud/compute_v1/services/url_maps/transports/base.py index beda678b7..c7d9f1373 100644 --- a/google/cloud/compute_v1/services/url_maps/transports/base.py +++ b/google/cloud/compute_v1/services/url_maps/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py index 2fc5141c5..5e4c8d357 100644 --- a/google/cloud/compute_v1/services/vpn_gateways/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_gateways/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py index 4ace00595..117cf5efe 100644 --- a/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py +++ b/google/cloud/compute_v1/services/vpn_tunnels/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/zone_operations/transports/base.py b/google/cloud/compute_v1/services/zone_operations/transports/base.py index a52d217f6..9122556e4 100644 --- a/google/cloud/compute_v1/services/zone_operations/transports/base.py +++ b/google/cloud/compute_v1/services/zone_operations/transports/base.py @@ -102,7 +102,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/compute_v1/services/zones/transports/base.py b/google/cloud/compute_v1/services/zones/transports/base.py index da15c9c13..3beec763a 100644 --- a/google/cloud/compute_v1/services/zones/transports/base.py +++ b/google/cloud/compute_v1/services/zones/transports/base.py @@ -103,7 +103,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/synth.metadata b/synth.metadata index 5228e7110..fd50dfc89 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,7 +11,7 @@ "git": { "name": "googleapis-discovery", "remote": "https://github.com/googleapis/googleapis-discovery.git", - "sha": "6a189a8bada35e2657a67b903cad7fee649f2dbc" + "sha": "abf4cec1ce9e02e4d7d650bf66137c347cdd0d44" } } ], diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index c65379315..d44fe2349 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -125,7 +125,22 @@ def test_accelerator_types_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.AcceleratorTypesRestTransport, "rest"),], +) +def test_accelerator_types_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [AcceleratorTypesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index 328166f78..57d5a84aa 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -119,7 +119,21 @@ def test_addresses_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.AddressesRestTransport, "rest"),] +) +def test_addresses_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [AddressesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index 160267976..1b110ae69 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -121,7 +121,21 @@ def test_autoscalers_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.AutoscalersRestTransport, "rest"),] +) +def test_autoscalers_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [AutoscalersClient,]) diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index 1534aefa3..e8646d4a8 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -124,7 +124,22 @@ def test_backend_buckets_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.BackendBucketsRestTransport, "rest"),], +) +def test_backend_buckets_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [BackendBucketsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index 5138b0293..392e14875 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -124,7 +124,22 @@ def test_backend_services_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.BackendServicesRestTransport, "rest"),], +) +def test_backend_services_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [BackendServicesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index 46b9e769f..572461610 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -119,7 +119,21 @@ def test_disk_types_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.DiskTypesRestTransport, "rest"),] +) +def test_disk_types_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [DiskTypesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index 6d1eb5d9f..e8e8a7859 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -116,7 +116,21 @@ def test_disks_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.DisksRestTransport, "rest"),] +) +def test_disks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [DisksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 678bb7231..12dc9631d 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -127,7 +127,22 @@ def test_external_vpn_gateways_client_service_account_always_use_jwt(client_clas ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.ExternalVpnGatewaysRestTransport, "rest"),], +) +def test_external_vpn_gateways_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ExternalVpnGatewaysClient,]) diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index 58f52021c..eac449dc8 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -125,7 +125,22 @@ def test_firewall_policies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.FirewallPoliciesRestTransport, "rest"),], +) +def test_firewall_policies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [FirewallPoliciesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index 10044c8dd..6c04cf87a 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -119,7 +119,21 @@ def test_firewalls_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.FirewallsRestTransport, "rest"),] +) +def test_firewalls_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [FirewallsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 5437aa2ab..80ae0e680 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -124,7 +124,22 @@ def test_forwarding_rules_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.ForwardingRulesRestTransport, "rest"),], +) +def test_forwarding_rules_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ForwardingRulesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index 69c70bed1..515934638 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -124,7 +124,22 @@ def test_global_addresses_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalAddressesRestTransport, "rest"),], +) +def test_global_addresses_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalAddressesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index fd582859f..300156af3 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -127,7 +127,22 @@ def test_global_forwarding_rules_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalForwardingRulesRestTransport, "rest"),], +) +def test_global_forwarding_rules_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalForwardingRulesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 5cd6a18f2..34c09c35c 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -131,7 +131,22 @@ def test_global_network_endpoint_groups_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalNetworkEndpointGroupsRestTransport, "rest"),], +) +def test_global_network_endpoint_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalNetworkEndpointGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index 089ab4ee4..6656b4709 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -125,7 +125,22 @@ def test_global_operations_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalOperationsRestTransport, "rest"),], +) +def test_global_operations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalOperationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 70c49eced..59bb119a6 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -131,7 +131,22 @@ def test_global_organization_operations_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalOrganizationOperationsRestTransport, "rest"),], +) +def test_global_organization_operations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalOrganizationOperationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index c17c75813..97aa2bd68 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -135,7 +135,22 @@ def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.GlobalPublicDelegatedPrefixesRestTransport, "rest"),], +) +def test_global_public_delegated_prefixes_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [GlobalPublicDelegatedPrefixesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index 251c4e1a7..b6a2cfc00 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -121,7 +121,21 @@ def test_health_checks_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.HealthChecksRestTransport, "rest"),] +) +def test_health_checks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [HealthChecksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index 45937053c..9baaa6f7a 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -116,7 +116,21 @@ def test_images_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.ImagesRestTransport, "rest"),] +) +def test_images_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ImagesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index 8e5bf87b5..de038d81c 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -127,7 +127,22 @@ def test_instance_group_managers_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.InstanceGroupManagersRestTransport, "rest"),], +) +def test_instance_group_managers_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InstanceGroupManagersClient,]) diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index 68e2330d4..921515906 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -124,7 +124,22 @@ def test_instance_groups_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.InstanceGroupsRestTransport, "rest"),], +) +def test_instance_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InstanceGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index 5765c5b37..38a33ea1c 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -125,7 +125,22 @@ def test_instance_templates_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.InstanceTemplatesRestTransport, "rest"),], +) +def test_instance_templates_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InstanceTemplatesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index 28cb7cf24..c01e713eb 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -119,7 +119,21 @@ def test_instances_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.InstancesRestTransport, "rest"),] +) +def test_instances_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InstancesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 89c6a2167..9e7a17aad 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -127,7 +127,22 @@ def test_interconnect_attachments_client_service_account_always_use_jwt(client_c ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.InterconnectAttachmentsRestTransport, "rest"),], +) +def test_interconnect_attachments_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InterconnectAttachmentsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index 731552395..357d4718f 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -127,7 +127,22 @@ def test_interconnect_locations_client_service_account_always_use_jwt(client_cla ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.InterconnectLocationsRestTransport, "rest"),], +) +def test_interconnect_locations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InterconnectLocationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index 935261983..25566abe7 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -124,7 +124,21 @@ def test_interconnects_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.InterconnectsRestTransport, "rest"),] +) +def test_interconnects_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [InterconnectsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index 6502cb5c8..868ad5c72 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -120,7 +120,21 @@ def test_license_codes_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.LicenseCodesRestTransport, "rest"),] +) +def test_license_codes_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [LicenseCodesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index ea0add277..dc4e7289c 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -119,7 +119,21 @@ def test_licenses_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.LicensesRestTransport, "rest"),] +) +def test_licenses_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [LicensesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index 7834d283a..17155d46a 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -121,7 +121,21 @@ def test_machine_types_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.MachineTypesRestTransport, "rest"),] +) +def test_machine_types_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [MachineTypesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index ec8cc9488..5f9f6d7f3 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -127,7 +127,22 @@ def test_network_endpoint_groups_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.NetworkEndpointGroupsRestTransport, "rest"),], +) +def test_network_endpoint_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [NetworkEndpointGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 27204e6d3..58fecb8e5 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -119,7 +119,21 @@ def test_networks_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.NetworksRestTransport, "rest"),] +) +def test_networks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [NetworksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index 6fbd90776..79aa2a051 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -121,7 +121,21 @@ def test_node_groups_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.NodeGroupsRestTransport, "rest"),] +) +def test_node_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [NodeGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index 0a762bcbd..d6865cc0a 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -124,7 +124,21 @@ def test_node_templates_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.NodeTemplatesRestTransport, "rest"),] +) +def test_node_templates_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [NodeTemplatesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index b6cbd36c6..c377ffaa5 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -119,7 +119,21 @@ def test_node_types_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.NodeTypesRestTransport, "rest"),] +) +def test_node_types_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [NodeTypesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 604de28ce..a458bcb08 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -125,7 +125,22 @@ def test_packet_mirrorings_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.PacketMirroringsRestTransport, "rest"),], +) +def test_packet_mirrorings_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [PacketMirroringsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index 9fd6c440f..13684daa2 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -119,7 +119,21 @@ def test_projects_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.ProjectsRestTransport, "rest"),] +) +def test_projects_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ProjectsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index 56224c11c..fc342fc19 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -127,7 +127,22 @@ def test_public_advertised_prefixes_client_service_account_always_use_jwt(client ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.PublicAdvertisedPrefixesRestTransport, "rest"),], +) +def test_public_advertised_prefixes_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [PublicAdvertisedPrefixesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index 62d518db6..de406c21f 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -127,7 +127,22 @@ def test_public_delegated_prefixes_client_service_account_always_use_jwt(client_ ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.PublicDelegatedPrefixesRestTransport, "rest"),], +) +def test_public_delegated_prefixes_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [PublicDelegatedPrefixesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 36812b502..06c821eb9 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -125,7 +125,22 @@ def test_region_autoscalers_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionAutoscalersRestTransport, "rest"),], +) +def test_region_autoscalers_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionAutoscalersClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index 8b2a6dd4e..da782230d 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -127,7 +127,22 @@ def test_region_backend_services_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionBackendServicesRestTransport, "rest"),], +) +def test_region_backend_services_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionBackendServicesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 853d49b74..3eca52860 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -125,7 +125,22 @@ def test_region_commitments_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionCommitmentsRestTransport, "rest"),], +) +def test_region_commitments_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionCommitmentsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index 6686f0d1a..9476ceecf 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -124,7 +124,22 @@ def test_region_disk_types_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionDiskTypesRestTransport, "rest"),], +) +def test_region_disk_types_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionDiskTypesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index 6ea10fe39..ab70e9a0a 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -121,7 +121,21 @@ def test_region_disks_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.RegionDisksRestTransport, "rest"),] +) +def test_region_disks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionDisksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index af9d97f20..a391b41e3 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -131,7 +131,22 @@ def test_region_health_check_services_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionHealthCheckServicesRestTransport, "rest"),], +) +def test_region_health_check_services_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionHealthCheckServicesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index a7ed0e491..d18984e74 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -127,7 +127,22 @@ def test_region_health_checks_client_service_account_always_use_jwt(client_class ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionHealthChecksRestTransport, "rest"),], +) +def test_region_health_checks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionHealthChecksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index 614a6ef84..1ed41850d 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -131,7 +131,22 @@ def test_region_instance_group_managers_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionInstanceGroupManagersRestTransport, "rest"),], +) +def test_region_instance_group_managers_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionInstanceGroupManagersClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 373304bf6..f67c97fd0 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -127,7 +127,22 @@ def test_region_instance_groups_client_service_account_always_use_jwt(client_cla ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionInstanceGroupsRestTransport, "rest"),], +) +def test_region_instance_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionInstanceGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index d3bc13d84..f813127f5 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -123,7 +123,22 @@ def test_region_instances_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionInstancesRestTransport, "rest"),], +) +def test_region_instances_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionInstancesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index e72ea3311..d63b2bf21 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -131,7 +131,22 @@ def test_region_network_endpoint_groups_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionNetworkEndpointGroupsRestTransport, "rest"),], +) +def test_region_network_endpoint_groups_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionNetworkEndpointGroupsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 12f433490..16b47c5ed 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -131,7 +131,22 @@ def test_region_notification_endpoints_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionNotificationEndpointsRestTransport, "rest"),], +) +def test_region_notification_endpoints_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionNotificationEndpointsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index 489ed6f30..9bb9dd904 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -125,7 +125,22 @@ def test_region_operations_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionOperationsRestTransport, "rest"),], +) +def test_region_operations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionOperationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index 9197b9b30..5ec4569e8 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -127,7 +127,22 @@ def test_region_ssl_certificates_client_service_account_always_use_jwt(client_cl ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionSslCertificatesRestTransport, "rest"),], +) +def test_region_ssl_certificates_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionSslCertificatesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index 47df1f079..e8fadaa1b 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -127,7 +127,22 @@ def test_region_target_http_proxies_client_service_account_always_use_jwt(client ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionTargetHttpProxiesRestTransport, "rest"),], +) +def test_region_target_http_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionTargetHttpProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index 53978f7b4..3ade3d966 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -129,7 +129,22 @@ def test_region_target_https_proxies_client_service_account_always_use_jwt( ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.RegionTargetHttpsProxiesRestTransport, "rest"),], +) +def test_region_target_https_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionTargetHttpsProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index a6f314565..581f23197 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -124,7 +124,21 @@ def test_region_url_maps_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.RegionUrlMapsRestTransport, "rest"),] +) +def test_region_url_maps_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionUrlMapsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index 6b7151b58..7996022c2 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -118,7 +118,21 @@ def test_regions_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.RegionsRestTransport, "rest"),] +) +def test_regions_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RegionsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index 8a6c9433f..792889e6a 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -121,7 +121,21 @@ def test_reservations_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.ReservationsRestTransport, "rest"),] +) +def test_reservations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ReservationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index 7bab7a43b..4d9589b52 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -125,7 +125,22 @@ def test_resource_policies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.ResourcePoliciesRestTransport, "rest"),], +) +def test_resource_policies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ResourcePoliciesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index 0c629e8c2..34a0632f9 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -118,7 +118,21 @@ def test_routers_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.RoutersRestTransport, "rest"),] +) +def test_routers_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RoutersClient,]) diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 9f24d25e2..5f01fd4a6 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -116,7 +116,21 @@ def test_routes_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.RoutesRestTransport, "rest"),] +) +def test_routes_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [RoutesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index e27db9c3d..aaecb5faa 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -125,7 +125,22 @@ def test_security_policies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.SecurityPoliciesRestTransport, "rest"),], +) +def test_security_policies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [SecurityPoliciesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index f46ec71e8..91eb4289d 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -119,7 +119,21 @@ def test_snapshots_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.SnapshotsRestTransport, "rest"),] +) +def test_snapshots_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [SnapshotsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index 704667755..987f7e153 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -124,7 +124,22 @@ def test_ssl_certificates_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.SslCertificatesRestTransport, "rest"),], +) +def test_ssl_certificates_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [SslCertificatesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index b410c694d..cd2c0a8fb 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -121,7 +121,21 @@ def test_ssl_policies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.SslPoliciesRestTransport, "rest"),] +) +def test_ssl_policies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [SslPoliciesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index 07dcd71fd..aca91cef4 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -121,7 +121,21 @@ def test_subnetworks_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.SubnetworksRestTransport, "rest"),] +) +def test_subnetworks_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [SubnetworksClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index d4ad0894b..62ce6b3b1 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -125,7 +125,22 @@ def test_target_grpc_proxies_client_service_account_always_use_jwt(client_class) ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetGrpcProxiesRestTransport, "rest"),], +) +def test_target_grpc_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetGrpcProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 5880f4b71..be55791c4 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -125,7 +125,22 @@ def test_target_http_proxies_client_service_account_always_use_jwt(client_class) ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetHttpProxiesRestTransport, "rest"),], +) +def test_target_http_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetHttpProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index c1b092ae9..db5c24865 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -127,7 +127,22 @@ def test_target_https_proxies_client_service_account_always_use_jwt(client_class ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetHttpsProxiesRestTransport, "rest"),], +) +def test_target_https_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetHttpsProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index 91aba31aa..8ff737298 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -124,7 +124,22 @@ def test_target_instances_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetInstancesRestTransport, "rest"),], +) +def test_target_instances_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetInstancesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index da9d7acc2..4519bd968 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -121,7 +121,21 @@ def test_target_pools_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.TargetPoolsRestTransport, "rest"),] +) +def test_target_pools_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetPoolsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index 95f69b6a5..b3db01509 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -125,7 +125,22 @@ def test_target_ssl_proxies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetSslProxiesRestTransport, "rest"),], +) +def test_target_ssl_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetSslProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index d08cfe6c0..5507c263f 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -125,7 +125,22 @@ def test_target_tcp_proxies_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetTcpProxiesRestTransport, "rest"),], +) +def test_target_tcp_proxies_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetTcpProxiesClient,]) diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index fb2e300d3..7126af9ea 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -125,7 +125,22 @@ def test_target_vpn_gateways_client_service_account_always_use_jwt(client_class) ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.TargetVpnGatewaysRestTransport, "rest"),], +) +def test_target_vpn_gateways_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [TargetVpnGatewaysClient,]) diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index 01162e6dc..a9c8e2ab8 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -118,7 +118,21 @@ def test_url_maps_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.UrlMapsRestTransport, "rest"),] +) +def test_url_maps_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [UrlMapsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index ea2072096..d3fc29192 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -121,7 +121,21 @@ def test_vpn_gateways_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.VpnGatewaysRestTransport, "rest"),] +) +def test_vpn_gateways_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [VpnGatewaysClient,]) diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index 4dbc30c0d..174577803 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -121,7 +121,21 @@ def test_vpn_tunnels_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.VpnTunnelsRestTransport, "rest"),] +) +def test_vpn_tunnels_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [VpnTunnelsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index e8e13b6ac..af6ac4528 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -124,7 +124,22 @@ def test_zone_operations_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [(transports.ZoneOperationsRestTransport, "rest"),], +) +def test_zone_operations_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ZoneOperationsClient,]) diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 87665bb2a..06b5c182a 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -116,7 +116,21 @@ def test_zones_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", [(transports.ZonesRestTransport, "rest"),] +) +def test_zones_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [ZonesClient,]) From b348c2d31e3e8f880f0c2c881abcded262c164e6 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 5 Aug 2021 23:08:09 +0000 Subject: [PATCH 3/5] fix!: regenerate competu.proto with uint64/int64 field types where appropriate (instead of string) This is a breaking chagne for the clients Source-Author: Vadym Matsishevskyi <25311427+vam-google@users.noreply.github.com> Source-Date: Wed Jun 30 16:36:27 2021 -0700 Source-Repo: googleapis/googleapis-discovery Source-Sha: c5bb8d324832f638d86bc1348fb45fb3d9c1fb30 Source-Link: https://github.com/googleapis/googleapis-discovery/commit/c5bb8d324832f638d86bc1348fb45fb3d9c1fb30 --- google/cloud/compute_v1/types/compute.py | 404 +++++++++--------- synth.metadata | 2 +- .../compute_v1/test_accelerator_types.py | 4 +- tests/unit/gapic/compute_v1/test_addresses.py | 20 +- .../unit/gapic/compute_v1/test_autoscalers.py | 36 +- .../gapic/compute_v1/test_backend_buckets.py | 52 +-- .../gapic/compute_v1/test_backend_services.py | 60 +-- .../unit/gapic/compute_v1/test_disk_types.py | 8 +- tests/unit/gapic/compute_v1/test_disks.py | 84 ++-- .../compute_v1/test_external_vpn_gateways.py | 28 +- .../compute_v1/test_firewall_policies.py | 84 ++-- tests/unit/gapic/compute_v1/test_firewalls.py | 36 +- .../gapic/compute_v1/test_forwarding_rules.py | 48 +-- .../gapic/compute_v1/test_global_addresses.py | 20 +- .../test_global_forwarding_rules.py | 48 +-- .../test_global_network_endpoint_groups.py | 36 +- .../compute_v1/test_global_operations.py | 16 +- .../test_global_organization_operations.py | 8 +- .../test_global_public_delegated_prefixes.py | 28 +- .../gapic/compute_v1/test_health_checks.py | 36 +- tests/unit/gapic/compute_v1/test_images.py | 86 ++-- .../test_instance_group_managers.py | 116 ++--- .../gapic/compute_v1/test_instance_groups.py | 44 +- .../compute_v1/test_instance_templates.py | 20 +- tests/unit/gapic/compute_v1/test_instances.py | 256 +++++------ .../test_interconnect_attachments.py | 32 +- .../compute_v1/test_interconnect_locations.py | 12 +- .../gapic/compute_v1/test_interconnects.py | 28 +- .../gapic/compute_v1/test_license_codes.py | 4 +- tests/unit/gapic/compute_v1/test_licenses.py | 24 +- .../gapic/compute_v1/test_machine_types.py | 11 +- .../test_network_endpoint_groups.py | 36 +- tests/unit/gapic/compute_v1/test_networks.py | 60 +-- .../unit/gapic/compute_v1/test_node_groups.py | 52 +-- .../gapic/compute_v1/test_node_templates.py | 20 +- .../unit/gapic/compute_v1/test_node_types.py | 4 +- .../compute_v1/test_packet_mirrorings.py | 28 +- tests/unit/gapic/compute_v1/test_projects.py | 80 ++-- .../test_public_advertised_prefixes.py | 28 +- .../test_public_delegated_prefixes.py | 28 +- .../compute_v1/test_region_autoscalers.py | 36 +- .../test_region_backend_services.py | 36 +- .../compute_v1/test_region_commitments.py | 18 +- .../compute_v1/test_region_disk_types.py | 8 +- .../gapic/compute_v1/test_region_disks.py | 80 ++-- .../test_region_health_check_services.py | 28 +- .../compute_v1/test_region_health_checks.py | 36 +- .../test_region_instance_group_managers.py | 116 ++--- .../compute_v1/test_region_instance_groups.py | 12 +- .../gapic/compute_v1/test_region_instances.py | 12 +- .../test_region_network_endpoint_groups.py | 20 +- .../test_region_notification_endpoints.py | 20 +- .../compute_v1/test_region_operations.py | 16 +- .../test_region_ssl_certificates.py | 20 +- .../test_region_target_http_proxies.py | 28 +- .../test_region_target_https_proxies.py | 36 +- .../gapic/compute_v1/test_region_url_maps.py | 36 +- tests/unit/gapic/compute_v1/test_regions.py | 4 +- .../gapic/compute_v1/test_reservations.py | 38 +- .../compute_v1/test_resource_policies.py | 20 +- tests/unit/gapic/compute_v1/test_routers.py | 36 +- tests/unit/gapic/compute_v1/test_routes.py | 20 +- .../compute_v1/test_security_policies.py | 52 +-- tests/unit/gapic/compute_v1/test_snapshots.py | 36 +- .../gapic/compute_v1/test_ssl_certificates.py | 20 +- .../gapic/compute_v1/test_ssl_policies.py | 28 +- .../unit/gapic/compute_v1/test_subnetworks.py | 44 +- .../compute_v1/test_target_grpc_proxies.py | 28 +- .../compute_v1/test_target_http_proxies.py | 36 +- .../compute_v1/test_target_https_proxies.py | 60 +-- .../gapic/compute_v1/test_target_instances.py | 20 +- .../gapic/compute_v1/test_target_pools.py | 60 +-- .../compute_v1/test_target_ssl_proxies.py | 52 +-- .../compute_v1/test_target_tcp_proxies.py | 36 +- .../compute_v1/test_target_vpn_gateways.py | 20 +- tests/unit/gapic/compute_v1/test_url_maps.py | 44 +- .../gapic/compute_v1/test_vpn_gateways.py | 28 +- .../unit/gapic/compute_v1/test_vpn_tunnels.py | 20 +- .../gapic/compute_v1/test_zone_operations.py | 16 +- tests/unit/gapic/compute_v1/test_zones.py | 4 +- 80 files changed, 1645 insertions(+), 1662 deletions(-) diff --git a/google/cloud/compute_v1/types/compute.py b/google/cloud/compute_v1/types/compute.py index 182ce63ae..1729ee0a6 100644 --- a/google/cloud/compute_v1/types/compute.py +++ b/google/cloud/compute_v1/types/compute.py @@ -1257,7 +1257,7 @@ class AcceleratorType(proto.Message): description (str): [Output Only] An optional textual description of the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -1283,7 +1283,7 @@ class AcceleratorType(proto.Message): proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", ) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) maximum_cards_per_instance = proto.Field( proto.INT32, number=263814482, optional=True, @@ -1590,7 +1590,7 @@ class Address(proto.Message): description (str): An optional description of this resource. Provide this field when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. ip_version (google.cloud.compute_v1.types.Address.IpVersion): @@ -1748,7 +1748,7 @@ class Status(proto.Enum): ) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ip_version = proto.Field( proto.ENUM, number=294959552, optional=True, enum=IpVersion, ) @@ -1921,7 +1921,7 @@ class AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk( ): r""" Attributes: - disk_size_gb (str): + disk_size_gb (int): Specifies the size of the disk in base-2 GB. interface (google.cloud.compute_v1.types.AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk.Interface): Specifies the disk interface to use for @@ -1941,7 +1941,7 @@ class Interface(proto.Enum): NVME = 2408800 SCSI = 2539686 - disk_size_gb = proto.Field(proto.STRING, number=316263735, optional=True,) + disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) interface = proto.Field( proto.ENUM, number=502623545, optional=True, enum=Interface, ) @@ -1987,17 +1987,17 @@ class AllocationSpecificSKUReservation(proto.Message): instance configuration. Attributes: - count (str): + count (int): Specifies the number of resources that are allocated. - in_use_count (str): + in_use_count (int): [Output Only] Indicates how many instances are in use. instance_properties (google.cloud.compute_v1.types.AllocationSpecificSKUAllocationReservedInstanceProperties): The instance properties for the reservation. """ - count = proto.Field(proto.STRING, number=94851343, optional=True,) - in_use_count = proto.Field(proto.STRING, number=493458877, optional=True,) + count = proto.Field(proto.INT64, number=94851343, optional=True,) + in_use_count = proto.Field(proto.INT64, number=493458877, optional=True,) instance_properties = proto.Field( proto.MESSAGE, number=215355165, @@ -2080,7 +2080,7 @@ class AttachedDiskInitializeParams(proto.Message): the given region, the existing disk is attached to the new instance and the new disk is not created. - disk_size_gb (str): + disk_size_gb (int): Specifies the size of the disk in base-2 GB. The size must be at least 10 GB. If you specify a sourceImage, which is required for boot disks, @@ -2113,7 +2113,7 @@ class AttachedDiskInitializeParams(proto.Message): Specifies which action to take on instance update with this disk. Default is to use the existing disk. - provisioned_iops (str): + provisioned_iops (int): Indicates how many IOPS must be provisioned for the disk. resource_policies (Sequence[str]): @@ -2186,13 +2186,13 @@ class OnUpdateAction(proto.Enum): description = proto.Field(proto.STRING, number=422937596, optional=True,) disk_name = proto.Field(proto.STRING, number=92807149, optional=True,) - disk_size_gb = proto.Field(proto.STRING, number=316263735, optional=True,) + disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) disk_type = proto.Field(proto.STRING, number=93009052, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) on_update_action = proto.Field( proto.ENUM, number=202451980, optional=True, enum=OnUpdateAction, ) - provisioned_iops = proto.Field(proto.STRING, number=186769108, optional=True,) + provisioned_iops = proto.Field(proto.INT64, number=186769108, optional=True,) resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) source_image = proto.Field(proto.STRING, number=50443319, optional=True,) source_image_encryption_key = proto.Field( @@ -2277,7 +2277,7 @@ class AttachedDisk(proto.Message): supplied encryption keys, so you cannot use your own keys to encrypt disks in a managed instance group. - disk_size_gb (str): + disk_size_gb (int): The size of the disk in GB. guest_os_features (Sequence[google.cloud.compute_v1.types.GuestOsFeature]): A list of features to enable on the guest @@ -2370,7 +2370,7 @@ class Type(proto.Enum): disk_encryption_key = proto.Field( proto.MESSAGE, number=271660677, optional=True, message="CustomerEncryptionKey", ) - disk_size_gb = proto.Field(proto.STRING, number=316263735, optional=True,) + disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) guest_os_features = proto.RepeatedField( proto.MESSAGE, number=79294545, message="GuestOsFeature", ) @@ -2789,7 +2789,7 @@ class Autoscaler(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -2870,7 +2870,7 @@ class Status(proto.Enum): ) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) recommended_size = proto.Field(proto.INT32, number=257915749, optional=True,) @@ -3502,7 +3502,7 @@ class BackendBucketCdnPolicy(proto.Message): cached response. The maximum allowed value is 604800 (1 week). Set this to zero (0) to disable serve-while-stale. - signed_url_cache_max_age_sec (str): + signed_url_cache_max_age_sec (int): Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. @@ -3563,7 +3563,7 @@ class CacheMode(proto.Enum): request_coalescing = proto.Field(proto.BOOL, number=532808276, optional=True,) serve_while_stale = proto.Field(proto.INT32, number=236682203, optional=True,) signed_url_cache_max_age_sec = proto.Field( - proto.STRING, number=269374534, optional=True, + proto.INT64, number=269374534, optional=True, ) signed_url_key_names = proto.RepeatedField(proto.STRING, number=371848885,) @@ -3591,7 +3591,7 @@ class BackendBucket(proto.Message): enable_cdn (bool): If true, enable Cloud CDN for this BackendBucket. - id (str): + id (int): [Output Only] Unique identifier for the resource; defined by the server. kind (str): @@ -3620,7 +3620,7 @@ class BackendBucket(proto.Message): custom_response_headers = proto.RepeatedField(proto.STRING, number=387539094,) description = proto.Field(proto.STRING, number=422937596, optional=True,) enable_cdn = proto.Field(proto.BOOL, number=282942321, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) self_link = proto.Field(proto.STRING, number=456214797, optional=True,) @@ -3817,7 +3817,7 @@ class BackendServiceCdnPolicy(proto.Message): cached response. The maximum allowed value is 604800 (1 week). Set this to zero (0) to disable serve-while-stale. - signed_url_cache_max_age_sec (str): + signed_url_cache_max_age_sec (int): Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. @@ -3881,7 +3881,7 @@ class CacheMode(proto.Enum): request_coalescing = proto.Field(proto.BOOL, number=532808276, optional=True,) serve_while_stale = proto.Field(proto.INT32, number=236682203, optional=True,) signed_url_cache_max_age_sec = proto.Field( - proto.STRING, number=269374534, optional=True, + proto.INT64, number=269374534, optional=True, ) signed_url_key_names = proto.RepeatedField(proto.STRING, number=371848885,) @@ -3953,7 +3953,7 @@ class ConsistentHashLoadBalancerSettings(proto.Message): The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD. - minimum_ring_size (str): + minimum_ring_size (int): The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load @@ -3970,7 +3970,7 @@ class ConsistentHashLoadBalancerSettings(proto.Message): message="ConsistentHashLoadBalancerSettingsHttpCookie", ) http_header_name = proto.Field(proto.STRING, number=234798022, optional=True,) - minimum_ring_size = proto.Field(proto.STRING, number=234380735, optional=True,) + minimum_ring_size = proto.Field(proto.INT64, number=234380735, optional=True,) class BackendServiceFailoverPolicy(proto.Message): @@ -4082,7 +4082,7 @@ class Duration(proto.Message): resolution. Durations less than one second are represented with a 0 ``seconds`` field and a positive ``nanos`` field. Must be from 0 to 999,999,999 inclusive. - seconds (str): + seconds (int): Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min \* 60 min/hr \* 24 hr/day \* 365.25 @@ -4090,7 +4090,7 @@ class Duration(proto.Message): """ nanos = proto.Field(proto.INT32, number=104586303, optional=True,) - seconds = proto.Field(proto.STRING, number=359484031, optional=True,) + seconds = proto.Field(proto.INT64, number=359484031, optional=True,) class OutlierDetection(proto.Message): @@ -4364,7 +4364,7 @@ class BackendService(proto.Message): on this resource. Not available for Internal TCP/UDP Load Balancing and Network Load Balancing. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -4695,7 +4695,7 @@ class SessionAffinity(proto.Enum): iap = proto.Field( proto.MESSAGE, number=104024, optional=True, message="BackendServiceIAP", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) load_balancing_scheme = proto.Field( proto.ENUM, number=363890244, optional=True, enum=LoadBalancingScheme, @@ -5318,7 +5318,7 @@ class BulkInsertInstanceResourcePerInstanceProperties(proto.Message): class BulkInsertInstanceResource(proto.Message): r""" Attributes: - count (str): + count (int): The maximum number of instances to create. instance_properties (google.cloud.compute_v1.types.InstanceProperties): The instance properties defining the VM @@ -5326,7 +5326,7 @@ class BulkInsertInstanceResource(proto.Message): sourceInstanceTemplate is not provided. location_policy (google.cloud.compute_v1.types.LocationPolicy): Policy for chosing target zone. - min_count (str): + min_count (int): The minimum number of instances to create. If no min_count is specified then count is used as the default value. If min_count instances cannot be created, then no instances @@ -5369,14 +5369,14 @@ class BulkInsertInstanceResource(proto.Message): This field is optional. """ - count = proto.Field(proto.STRING, number=94851343, optional=True,) + count = proto.Field(proto.INT64, number=94851343, optional=True,) instance_properties = proto.Field( proto.MESSAGE, number=215355165, optional=True, message="InstanceProperties", ) location_policy = proto.Field( proto.MESSAGE, number=465689852, optional=True, message="LocationPolicy", ) - min_count = proto.Field(proto.STRING, number=523228386, optional=True,) + min_count = proto.Field(proto.INT64, number=523228386, optional=True,) name_pattern = proto.Field(proto.STRING, number=413815260, optional=True,) per_instance_properties = proto.MapField( proto.STRING, @@ -5407,7 +5407,7 @@ class CacheInvalidationRule(proto.Message): class LicenseResourceCommitment(proto.Message): r"""Commitment for a particular license resource. Attributes: - amount (str): + amount (int): The number of licenses purchased. cores_per_license (str): Specifies the core range of the instance for @@ -5416,7 +5416,7 @@ class LicenseResourceCommitment(proto.Message): Any applicable license URI. """ - amount = proto.Field(proto.STRING, number=196759640, optional=True,) + amount = proto.Field(proto.INT64, number=196759640, optional=True,) cores_per_license = proto.Field(proto.STRING, number=32482324, optional=True,) license_ = proto.Field(proto.STRING, number=166757441, optional=True,) @@ -5438,7 +5438,7 @@ class Reservation(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -5487,7 +5487,7 @@ class Status(proto.Enum): commitment = proto.Field(proto.STRING, number=482134805, optional=True,) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) @@ -5513,7 +5513,7 @@ class ResourceCommitment(proto.Message): accelerator_type (str): Name of the accelerator type resource. Applicable only when the type is ACCELERATOR. - amount (str): + amount (int): The amount of the resource purchased (in a type-dependent unit, such as bytes). For vCPUs, this can just be an integer. For memory, this @@ -5537,7 +5537,7 @@ class Type(proto.Enum): VCPU = 2628978 accelerator_type = proto.Field(proto.STRING, number=138031246, optional=True,) - amount = proto.Field(proto.STRING, number=196759640, optional=True,) + amount = proto.Field(proto.INT64, number=196759640, optional=True,) type_ = proto.Field(proto.ENUM, number=3575610, optional=True, enum=Type,) @@ -5568,7 +5568,7 @@ class Commitment(proto.Message): resource. end_timestamp (str): [Output Only] Commitment end time in RFC3339 text format. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -5651,7 +5651,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) end_timestamp = proto.Field(proto.STRING, number=468096690, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) license_resource = proto.Field( proto.MESSAGE, @@ -5951,7 +5951,7 @@ class Disk(proto.Message): operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -5976,7 +5976,7 @@ class Disk(proto.Message): [Output Only] Last attach timestamp in RFC3339 text format. last_detach_timestamp (str): [Output Only] Last detach timestamp in RFC3339 text format. - license_codes (Sequence[str]): + license_codes (Sequence[int]): Integer license codes indicating which licenses are attached to this disk. licenses (Sequence[str]): @@ -5997,7 +5997,7 @@ class Disk(proto.Message): except the last character, which cannot be a dash. options (str): Internal use only. - physical_block_size_bytes (str): + physical_block_size_bytes (int): Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. The currently supported size is @@ -6005,7 +6005,7 @@ class Disk(proto.Message): an unsupported value is requested, the error message will list the supported values for the caller's project. - provisioned_iops (str): + provisioned_iops (int): Indicates how many IOPS must be provisioned for the disk. region (str): @@ -6025,7 +6025,7 @@ class Disk(proto.Message): self_link (str): [Output Only] Server-defined fully-qualified URL for this resource. - size_gb (str): + size_gb (int): Size, in GB, of the persistent disk. You can specify this field when creating a persistent disk using the sourceImage, sourceSnapshot, or @@ -6169,27 +6169,27 @@ class Status(proto.Enum): guest_os_features = proto.RepeatedField( proto.MESSAGE, number=79294545, message="GuestOsFeature", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) last_attach_timestamp = proto.Field(proto.STRING, number=42159653, optional=True,) last_detach_timestamp = proto.Field(proto.STRING, number=56471027, optional=True,) - license_codes = proto.RepeatedField(proto.STRING, number=45482664,) + license_codes = proto.RepeatedField(proto.INT64, number=45482664,) licenses = proto.RepeatedField(proto.STRING, number=337642578,) location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) options = proto.Field(proto.STRING, number=361137822, optional=True,) physical_block_size_bytes = proto.Field( - proto.STRING, number=420007943, optional=True, + proto.INT64, number=420007943, optional=True, ) - provisioned_iops = proto.Field(proto.STRING, number=186769108, optional=True,) + provisioned_iops = proto.Field(proto.INT64, number=186769108, optional=True,) region = proto.Field(proto.STRING, number=138946292, optional=True,) replica_zones = proto.RepeatedField(proto.STRING, number=48438272,) resource_policies = proto.RepeatedField(proto.STRING, number=22220385,) satisfies_pzs = proto.Field(proto.BOOL, number=480964267, optional=True,) self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - size_gb = proto.Field(proto.STRING, number=494929369, optional=True,) + size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) source_disk = proto.Field(proto.STRING, number=451753793, optional=True,) source_disk_id = proto.Field(proto.STRING, number=454190809, optional=True,) source_image = proto.Field(proto.STRING, number=50443319, optional=True,) @@ -6423,14 +6423,14 @@ class DiskType(proto.Message): Attributes: creation_timestamp (str): [Output Only] Creation timestamp in RFC3339 text format. - default_disk_size_gb (str): + default_disk_size_gb (int): [Output Only] Server-defined default disk size in GB. deprecated (google.cloud.compute_v1.types.DeprecationStatus): [Output Only] The deprecation status associated with this disk type. description (str): [Output Only] An optional description of this resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -6455,12 +6455,12 @@ class DiskType(proto.Message): """ creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) - default_disk_size_gb = proto.Field(proto.STRING, number=270619253, optional=True,) + default_disk_size_gb = proto.Field(proto.INT64, number=270619253, optional=True,) deprecated = proto.Field( proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", ) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) region = proto.Field(proto.STRING, number=138946292, optional=True,) @@ -6593,12 +6593,12 @@ class DisksRemoveResourcePoliciesRequest(proto.Message): class DisksResizeRequest(proto.Message): r""" Attributes: - size_gb (str): + size_gb (int): The new size of the persistent disk, which is specified in GB. """ - size_gb = proto.Field(proto.STRING, number=494929369, optional=True,) + size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) class DisplayDevice(proto.Message): @@ -6776,7 +6776,7 @@ class ExternalVpnGateway(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. interfaces (Sequence[google.cloud.compute_v1.types.ExternalVpnGatewayInterface]): @@ -6830,7 +6830,7 @@ class RedundancyType(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) interfaces = proto.RepeatedField( proto.MESSAGE, number=12073562, message="ExternalVpnGatewayInterface", ) @@ -7026,7 +7026,7 @@ class Firewall(proto.Message): not enforced and the network behaves as if it did not exist. If this is unspecified, the firewall rule will be enabled. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -7156,7 +7156,7 @@ class Direction(proto.Enum): proto.ENUM, number=111150975, optional=True, enum=Direction, ) disabled = proto.Field(proto.BOOL, number=270940796, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) log_config = proto.Field( proto.MESSAGE, number=351299741, optional=True, message="FirewallLogConfig", @@ -7371,7 +7371,7 @@ class FirewallPolicy(proto.Message): fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the firewall policy. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -7417,7 +7417,7 @@ class FirewallPolicy(proto.Message): description = proto.Field(proto.STRING, number=422937596, optional=True,) display_name = proto.Field(proto.STRING, number=4473832, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) parent = proto.Field(proto.STRING, number=78317738, optional=True,) @@ -7713,7 +7713,7 @@ class ForwardingRule(proto.Message): from another concurrent request. To see the latest fingerprint, make a get() request to retrieve a ForwardingRule. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. ip_version (google.cloud.compute_v1.types.ForwardingRule.IpVersion): @@ -7858,7 +7858,7 @@ class ForwardingRule(proto.Message): For more information, see `Port specifications `__. - psc_connection_id (str): + psc_connection_id (int): [Output Only] The PSC connection id of the PSC Forwarding Rule. region (str): @@ -7995,7 +7995,7 @@ class NetworkTier(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ip_version = proto.Field( proto.ENUM, number=294959552, optional=True, enum=IpVersion, ) @@ -8016,7 +8016,7 @@ class NetworkTier(proto.Enum): ) port_range = proto.Field(proto.STRING, number=217518079, optional=True,) ports = proto.RepeatedField(proto.STRING, number=106854418,) - psc_connection_id = proto.Field(proto.STRING, number=292082397, optional=True,) + psc_connection_id = proto.Field(proto.UINT64, number=292082397, optional=True,) region = proto.Field(proto.STRING, number=138946292, optional=True,) self_link = proto.Field(proto.STRING, number=456214797, optional=True,) service_directory_registrations = proto.RepeatedField( @@ -8990,7 +8990,7 @@ class HealthCheck(proto.Message): https_health_check (google.cloud.compute_v1.types.HTTPSHealthCheck): - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -9064,7 +9064,7 @@ class Type(proto.Enum): https_health_check = proto.Field( proto.MESSAGE, number=436046905, optional=True, message="HTTPSHealthCheck", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) log_config = proto.Field( proto.MESSAGE, number=351299741, optional=True, message="HealthCheckLogConfig", @@ -9181,7 +9181,7 @@ class HealthCheckService(proto.Message): then UNHEALTHY is the HealthState of the entire health check service. If all backend's are healthy, the HealthState of the health check service is HEALTHY. . - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -9242,7 +9242,7 @@ class HealthStatusAggregationPolicy(proto.Enum): health_status_aggregation_policy = proto.Field( proto.ENUM, number=253163129, optional=True, enum=HealthStatusAggregationPolicy, ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) network_endpoint_groups = proto.RepeatedField(proto.STRING, number=29346733,) @@ -9586,16 +9586,16 @@ class Int64RangeMatch(proto.Message): within the specified integer range. Attributes: - range_end (str): + range_end (int): The end of the range (exclusive) in signed long integer format. - range_start (str): + range_start (int): The start of the range (inclusive) in signed long integer format. """ - range_end = proto.Field(proto.STRING, number=322439897, optional=True,) - range_start = proto.Field(proto.STRING, number=103333600, optional=True,) + range_end = proto.Field(proto.INT64, number=322439897, optional=True,) + range_start = proto.Field(proto.INT64, number=103333600, optional=True,) class HttpHeaderMatch(proto.Message): @@ -10280,7 +10280,7 @@ class Image(proto.Message): {$api_version}.images ==) Attributes: - archive_size_bytes (str): + archive_size_bytes (int): Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). creation_timestamp (str): @@ -10292,7 +10292,7 @@ class Image(proto.Message): An optional description of this resource. Provide this property when you create the resource. - disk_size_gb (str): + disk_size_gb (int): Size of the image when restored onto a persistent disk (in GB). family (str): @@ -10307,7 +10307,7 @@ class Image(proto.Message): operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. image_encryption_key (google.cloud.compute_v1.types.CustomerEncryptionKey): @@ -10342,7 +10342,7 @@ class Image(proto.Message): labels (Sequence[google.cloud.compute_v1.types.Image.LabelsEntry]): Labels to apply to this image. These can be later modified by the setLabels method. - license_codes (Sequence[str]): + license_codes (Sequence[int]): Integer license codes indicating which licenses are attached to this image. licenses (Sequence[str]): @@ -10454,25 +10454,25 @@ class Status(proto.Enum): PENDING = 35394935 READY = 77848963 - archive_size_bytes = proto.Field(proto.STRING, number=381093450, optional=True,) + archive_size_bytes = proto.Field(proto.INT64, number=381093450, optional=True,) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) deprecated = proto.Field( proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", ) description = proto.Field(proto.STRING, number=422937596, optional=True,) - disk_size_gb = proto.Field(proto.STRING, number=316263735, optional=True,) + disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) family = proto.Field(proto.STRING, number=328751972, optional=True,) guest_os_features = proto.RepeatedField( proto.MESSAGE, number=79294545, message="GuestOsFeature", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) image_encryption_key = proto.Field( proto.MESSAGE, number=379512583, optional=True, message="CustomerEncryptionKey", ) kind = proto.Field(proto.STRING, number=3292052, optional=True,) label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - license_codes = proto.RepeatedField(proto.STRING, number=45482664,) + license_codes = proto.RepeatedField(proto.INT64, number=45482664,) licenses = proto.RepeatedField(proto.STRING, number=337642578,) name = proto.Field(proto.STRING, number=3373707, optional=True,) raw_disk = proto.Field( @@ -10892,7 +10892,7 @@ class Instance(proto.Message): global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -11072,7 +11072,7 @@ class Status(proto.Enum): proto.MESSAGE, number=463595119, message="AcceleratorConfig", ) hostname = proto.Field(proto.STRING, number=237067315, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) @@ -11231,7 +11231,7 @@ class InstanceGroup(proto.Message): [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. - id (str): + id (int): [Output Only] A unique identifier for this instance group, generated by the server. kind (str): @@ -11280,7 +11280,7 @@ class InstanceGroup(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) named_ports = proto.RepeatedField( @@ -11719,7 +11719,7 @@ class InstanceGroupManager(proto.Message): conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager. - id (str): + id (int): [Output Only] A unique identifier for this resource type. The server generates this identifier. instance_group (str): @@ -11805,7 +11805,7 @@ class InstanceGroupManager(proto.Message): proto.MESSAGE, number=534558541, optional=True, message="DistributionPolicy", ) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) instance_group = proto.Field(proto.STRING, number=81095253, optional=True,) instance_template = proto.Field(proto.STRING, number=309248228, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) @@ -12228,7 +12228,7 @@ class ManagedInstance(proto.Message): list for an instance without stopping that instance. - VERIFYING The managed instance group has created the instance and it is in the process of being verified. - id (str): + id (int): [Output only] The unique identifier for this resource. This field is empty when instance does not exist. instance (str): @@ -12310,7 +12310,7 @@ class InstanceStatus(proto.Enum): current_action = proto.Field( proto.ENUM, number=178475964, optional=True, enum=CurrentAction, ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) instance = proto.Field(proto.STRING, number=18257045, optional=True,) instance_health = proto.RepeatedField( proto.MESSAGE, number=382667078, message="ManagedInstanceInstanceHealth", @@ -12866,7 +12866,7 @@ class InstanceTemplate(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] A unique identifier for this instance template. The server defines this identifier. kind (str): @@ -12901,7 +12901,7 @@ class InstanceTemplate(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) properties = proto.Field( @@ -13144,7 +13144,7 @@ class InterconnectOutageNotification(proto.Message): description (str): A description about the purpose of the outage. - end_time (str): + end_time (int): Scheduled end time for the outage (milliseconds since Unix epoch). issue_type (google.cloud.compute_v1.types.InterconnectOutageNotification.IssueType): @@ -13167,7 +13167,7 @@ class InterconnectOutageNotification(proto.Message): - GOOGLE: this notification as generated by Google. Note that the value of NSRC_GOOGLE has been deprecated in favor of GOOGLE. - start_time (str): + start_time (int): Scheduled start time for the outage (milliseconds since Unix epoch). state (google.cloud.compute_v1.types.InterconnectOutageNotification.State): @@ -13232,13 +13232,13 @@ class State(proto.Enum): affected_circuits = proto.RepeatedField(proto.STRING, number=177717013,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - end_time = proto.Field(proto.STRING, number=114938801, optional=True,) + end_time = proto.Field(proto.INT64, number=114938801, optional=True,) issue_type = proto.Field( proto.ENUM, number=369639136, optional=True, enum=IssueType, ) name = proto.Field(proto.STRING, number=3373707, optional=True,) source = proto.Field(proto.ENUM, number=177235995, optional=True, enum=Source,) - start_time = proto.Field(proto.STRING, number=37467274, optional=True,) + start_time = proto.Field(proto.INT64, number=37467274, optional=True,) state = proto.Field(proto.ENUM, number=109757585, optional=True, enum=State,) @@ -13281,7 +13281,7 @@ class Interconnect(proto.Message): [Output Only] Google reference ID to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. interconnect_attachments (Sequence[str]): @@ -13437,7 +13437,7 @@ class State(proto.Enum): ) google_ip_address = proto.Field(proto.STRING, number=443105954, optional=True,) google_reference_id = proto.Field(proto.STRING, number=534944469, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) interconnect_attachments = proto.RepeatedField(proto.STRING, number=425388415,) interconnect_type = proto.Field( proto.ENUM, number=515165259, optional=True, enum=InterconnectType, @@ -13593,7 +13593,7 @@ class InterconnectAttachment(proto.Message): [Output Only] Google reference ID, to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. [Deprecated] This field is not used. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. interconnect (str): @@ -13654,7 +13654,7 @@ class InterconnectAttachment(proto.Message): identifier of an PARTNER attachment used to initiate provisioning with a selected partner. Of the form "XXXXX/region/domain". - partner_asn (str): + partner_asn (int): Optional BGP ASN for the router supplied by a Layer 3 Partner if they configured BGP on behalf of the customer. Output only for PARTNER type, input only for @@ -13873,7 +13873,7 @@ class Type(proto.Enum): proto.ENUM, number=97980291, optional=True, enum=Encryption, ) google_reference_id = proto.Field(proto.STRING, number=534944469, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) interconnect = proto.Field(proto.STRING, number=224601230, optional=True,) ipsec_internal_addresses = proto.RepeatedField(proto.STRING, number=407648565,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) @@ -13883,7 +13883,7 @@ class Type(proto.Enum): proto.ENUM, number=201070847, optional=True, enum=OperationalStatus, ) pairing_key = proto.Field(proto.STRING, number=439695464, optional=True,) - partner_asn = proto.Field(proto.STRING, number=438166149, optional=True,) + partner_asn = proto.Field(proto.INT64, number=438166149, optional=True,) partner_metadata = proto.Field( proto.MESSAGE, number=65908934, @@ -14239,7 +14239,7 @@ class InterconnectLocationRegionInfo(proto.Message): a specific Cloud Region. Attributes: - expected_rtt_ms (str): + expected_rtt_ms (int): Expected round-trip time in milliseconds, from this InterconnectLocation to a VM in this region. @@ -14258,7 +14258,7 @@ class LocationPresence(proto.Enum): LP_GLOBAL = 429584062 LP_LOCAL_REGION = 488598851 - expected_rtt_ms = proto.Field(proto.STRING, number=422543866, optional=True,) + expected_rtt_ms = proto.Field(proto.INT64, number=422543866, optional=True,) location_presence = proto.Field( proto.ENUM, number=101517893, optional=True, enum=LocationPresence, ) @@ -14305,7 +14305,7 @@ class InterconnectLocation(proto.Message): facility_provider_facility_id (str): [Output Only] A provider-assigned Identifier for this facility (e.g., Ashburn-DC1). - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -14380,7 +14380,7 @@ class Status(proto.Enum): facility_provider_facility_id = proto.Field( proto.STRING, number=87269125, optional=True, ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) peeringdb_facility_id = proto.Field(proto.STRING, number=536567094, optional=True,) @@ -14484,13 +14484,13 @@ class License(proto.Message): An optional textual description of the resource; provided by the client when the resource is created. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): [Output Only] Type of resource. Always compute#license for licenses. - license_code (str): + license_code (int): [Output Only] The unique code used to attach this license to images, snapshots, and disks. name (str): @@ -14510,9 +14510,9 @@ class License(proto.Message): charges_use_fee = proto.Field(proto.BOOL, number=372412622, optional=True,) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) - license_code = proto.Field(proto.STRING, number=1467179, optional=True,) + license_code = proto.Field(proto.UINT64, number=1467179, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) resource_requirements = proto.Field( proto.MESSAGE, @@ -14551,7 +14551,7 @@ class LicenseCode(proto.Message): [Output Only] Creation timestamp in RFC3339 text format. description (str): [Output Only] Description of this License Code. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -14584,7 +14584,7 @@ class State(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) license_alias = proto.RepeatedField( proto.MESSAGE, number=43550930, message="LicenseCodeLicenseAlias", @@ -14849,7 +14849,7 @@ class MachineType(proto.Message): guest_cpus (int): [Output Only] The number of virtual CPUs that are available to the instance. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. image_space_gb (int): @@ -14863,7 +14863,7 @@ class MachineType(proto.Message): compute#machineType for machine types. maximum_persistent_disks (int): [Output Only] Maximum persistent disks allowed. - maximum_persistent_disks_size_gb (str): + maximum_persistent_disks_size_gb (int): [Output Only] Maximum total persistent disks size (GB) allowed. memory_mb (int): @@ -14890,7 +14890,7 @@ class MachineType(proto.Message): ) description = proto.Field(proto.STRING, number=422937596, optional=True,) guest_cpus = proto.Field(proto.INT32, number=393356754, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) image_space_gb = proto.Field(proto.INT32, number=75331864, optional=True,) is_shared_cpu = proto.Field(proto.BOOL, number=521399555, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) @@ -14898,7 +14898,7 @@ class MachineType(proto.Message): proto.INT32, number=496220941, optional=True, ) maximum_persistent_disks_size_gb = proto.Field( - proto.STRING, number=154274471, optional=True, + proto.INT64, number=154274471, optional=True, ) memory_mb = proto.Field(proto.INT32, number=116001171, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -15290,7 +15290,7 @@ class Network(proto.Message): gateway_i_pv4 (str): [Output Only] The gateway address for default routing out of the network, selected by GCP. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -15329,7 +15329,7 @@ class Network(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) gateway_i_pv4 = proto.Field(proto.STRING, number=178678877, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) mtu = proto.Field(proto.INT32, number=108462, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -15487,7 +15487,7 @@ class NetworkEndpointGroup(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -15561,7 +15561,7 @@ class NetworkEndpointType(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) default_port = proto.Field(proto.INT32, number=423377855, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) network = proto.Field(proto.STRING, number=232872494, optional=True,) @@ -16013,7 +16013,7 @@ class NodeGroup(proto.Message): resource. fingerprint (str): - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -16085,7 +16085,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) maintenance_policy = proto.Field( @@ -16390,7 +16390,7 @@ class NodeTemplate(proto.Message): resource. disks (Sequence[google.cloud.compute_v1.types.LocalDisk]): - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -16468,7 +16468,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) disks = proto.RepeatedField(proto.MESSAGE, number=95594102, message="LocalDisk",) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) node_affinity_labels = proto.MapField(proto.STRING, proto.STRING, number=339007161,) @@ -16618,7 +16618,7 @@ class NodeType(proto.Message): guest_cpus (int): [Output Only] The number of virtual CPUs that are available to the node type. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -16646,7 +16646,7 @@ class NodeType(proto.Message): ) description = proto.Field(proto.STRING, number=422937596, optional=True,) guest_cpus = proto.Field(proto.INT32, number=393356754, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) local_ssd_gb = proto.Field(proto.INT32, number=329237578, optional=True,) memory_mb = proto.Field(proto.INT32, number=116001171, optional=True,) @@ -16817,7 +16817,7 @@ class NotificationEndpoint(proto.Message): Settings of the gRPC notification endpoint including the endpoint URL and the retry duration. - id (str): + id (int): [Output Only] A unique identifier for this resource type. The server generates this identifier. kind (str): @@ -16850,7 +16850,7 @@ class NotificationEndpoint(proto.Message): optional=True, message="NotificationEndpointGrpcSettings", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) region = proto.Field(proto.STRING, number=138946292, optional=True,) @@ -17011,7 +17011,7 @@ class Operation(proto.Message): [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a ``404`` means the resource was not found. - id (str): + id (int): [Output Only] The unique identifier for the operation. This identifier is defined by the server. insert_time (str): @@ -17051,7 +17051,7 @@ class Operation(proto.Message): status_message (str): [Output Only] An optional textual description of the current status of the operation. - target_id (str): + target_id (int): [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. target_link (str): @@ -17087,7 +17087,7 @@ class Status(proto.Enum): error = proto.Field(proto.MESSAGE, number=96784904, optional=True, message="Error",) http_error_message = proto.Field(proto.STRING, number=202521945, optional=True,) http_error_status_code = proto.Field(proto.INT32, number=312345196, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) insert_time = proto.Field(proto.STRING, number=433722515, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -17099,7 +17099,7 @@ class Status(proto.Enum): start_time = proto.Field(proto.STRING, number=37467274, optional=True,) status = proto.Field(proto.ENUM, number=181260274, optional=True, enum=Status,) status_message = proto.Field(proto.STRING, number=297428154, optional=True,) - target_id = proto.Field(proto.STRING, number=258165385, optional=True,) + target_id = proto.Field(proto.UINT64, number=258165385, optional=True,) target_link = proto.Field(proto.STRING, number=62671336, optional=True,) user = proto.Field(proto.STRING, number=3599307, optional=True,) warnings = proto.RepeatedField(proto.MESSAGE, number=498091095, message="Warnings",) @@ -17343,7 +17343,7 @@ class PacketMirroring(proto.Message): filter (google.cloud.compute_v1.types.PacketMirroringFilter): Filter for mirrored traffic. If unspecified, all traffic is mirrored. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -17406,7 +17406,7 @@ class Enable(proto.Enum): filter = proto.Field( proto.MESSAGE, number=336120696, optional=True, message="PacketMirroringFilter", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) mirrored_resources = proto.Field( proto.MESSAGE, @@ -18059,7 +18059,7 @@ class Project(proto.Message): enabled_features (Sequence[str]): Restricted features enabled for use on this project. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. This is not the project ID, and is just a unique ID used by Compute Engine to @@ -18116,7 +18116,7 @@ class XpnProjectStatus(proto.Enum): ) description = proto.Field(proto.STRING, number=422937596, optional=True,) enabled_features = proto.RepeatedField(proto.STRING, number=469017467,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) quotas = proto.RepeatedField(proto.MESSAGE, number=125341947, message="Quota",) @@ -18296,7 +18296,7 @@ class PublicAdvertisedPrefix(proto.Message): conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a PublicAdvertisedPrefix. - id (str): + id (int): [Output Only] The unique identifier for the resource type. The server generates this identifier. ip_cidr_range (str): @@ -18342,7 +18342,7 @@ class Status(proto.Enum): description = proto.Field(proto.STRING, number=422937596, optional=True,) dns_verification_ip = proto.Field(proto.STRING, number=241011381, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -18463,7 +18463,7 @@ class PublicDelegatedPrefix(proto.Message): will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a PublicDelegatedPrefix. - id (str): + id (int): [Output Only] The unique identifier for the resource type. The server generates this identifier. ip_cidr_range (str): @@ -18511,7 +18511,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) is_live_migration = proto.Field(proto.BOOL, number=511823856, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) @@ -18650,7 +18650,7 @@ class Region(proto.Message): region. description (str): [Output Only] Textual description of the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -18682,7 +18682,7 @@ class Status(proto.Enum): proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", ) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) quotas = proto.RepeatedField(proto.MESSAGE, number=125341947, message="Quota",) @@ -18791,12 +18791,12 @@ class RegionDisksRemoveResourcePoliciesRequest(proto.Message): class RegionDisksResizeRequest(proto.Message): r""" Attributes: - size_gb (str): + size_gb (int): The new size of the regional persistent disk, which is specified in GB. """ - size_gb = proto.Field(proto.STRING, number=494929369, optional=True,) + size_gb = proto.Field(proto.INT64, number=494929369, optional=True,) class RegionInstanceGroupList(proto.Message): @@ -19409,7 +19409,7 @@ class UrlMap(proto.Message): validateForProxyless field set to true. host_rules (Sequence[google.cloud.compute_v1.types.HostRule]): The list of HostRules to use against the URL. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -19459,7 +19459,7 @@ class UrlMap(proto.Message): host_rules = proto.RepeatedField( proto.MESSAGE, number=311804832, message="HostRule", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) path_matchers = proto.RepeatedField( @@ -19584,12 +19584,12 @@ def raw_page(self): class ReservationsResizeRequest(proto.Message): r""" Attributes: - specific_sku_count (str): + specific_sku_count (int): Number of allocated resources can be resized with minimum = 1 and maximum = 1000. """ - specific_sku_count = proto.Field(proto.STRING, number=13890720, optional=True,) + specific_sku_count = proto.Field(proto.INT64, number=13890720, optional=True,) class ResourceGroupReference(proto.Message): @@ -19619,7 +19619,7 @@ class ResourcePolicy(proto.Message): group_placement_policy (google.cloud.compute_v1.types.ResourcePolicyGroupPlacementPolicy): Resource policy for instances for placement configuration. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. instance_schedule_policy (google.cloud.compute_v1.types.ResourcePolicyInstanceSchedulePolicy): @@ -19668,7 +19668,7 @@ class Status(proto.Enum): optional=True, message="ResourcePolicyGroupPlacementPolicy", ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) instance_schedule_policy = proto.Field( proto.MESSAGE, number=344877104, @@ -20160,7 +20160,7 @@ class Route(proto.Message): The destination range of outgoing packets that this route applies to. Both IPv4 and IPv6 are supported. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -20233,7 +20233,7 @@ class Route(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) dest_range = proto.Field(proto.STRING, number=381327712, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) network = proto.Field(proto.STRING, number=232872494, optional=True,) @@ -20696,7 +20696,7 @@ class Router(proto.Message): (IPsec-encrypted Cloud Interconnect feature). Not currently available in all Interconnect locations. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. interfaces (Sequence[google.cloud.compute_v1.types.RouterInterface]): @@ -20739,7 +20739,7 @@ class Router(proto.Message): encrypted_interconnect_router = proto.Field( proto.BOOL, number=297996575, optional=True, ) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) interfaces = proto.RepeatedField( proto.MESSAGE, number=12073562, message="RouterInterface", ) @@ -21232,7 +21232,7 @@ class SecurityPolicy(proto.Message): fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -21260,7 +21260,7 @@ class SecurityPolicy(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) rules = proto.RepeatedField( @@ -21378,14 +21378,14 @@ class SerialPortOutput(proto.Message): kind (str): [Output Only] Type of the resource. Always compute#serialPortOutput for serial port output. - next_ (str): + next_ (int): [Output Only] The position of the next byte of content, regardless of whether the content exists, following the output returned in the ``contents`` property. Use this value in the next request as the start parameter. self_link (str): [Output Only] Server-defined URL for this resource. - start (str): + start (int): The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer @@ -21397,9 +21397,9 @@ class SerialPortOutput(proto.Message): contents = proto.Field(proto.STRING, number=506419994, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) - next_ = proto.Field(proto.STRING, number=3377907, optional=True,) + next_ = proto.Field(proto.INT64, number=3377907, optional=True,) self_link = proto.Field(proto.STRING, number=456214797, optional=True,) - start = proto.Field(proto.STRING, number=109757538, optional=True,) + start = proto.Field(proto.INT64, number=109757538, optional=True,) class ShieldedInstanceIdentityEntry(proto.Message): @@ -21498,12 +21498,12 @@ class Snapshot(proto.Message): An optional description of this resource. Provide this property when you create the resource. - disk_size_gb (str): + disk_size_gb (int): [Output Only] Size of the source disk, specified in GB. - download_bytes (str): + download_bytes (int): [Output Only] Number of bytes downloaded to restore a snapshot to a disk. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -21525,7 +21525,7 @@ class Snapshot(proto.Message): Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty. - license_codes (Sequence[str]): + license_codes (Sequence[int]): [Output Only] Integer license codes indicating which licenses are attached to this snapshot. licenses (Sequence[str]): @@ -21580,7 +21580,7 @@ class Snapshot(proto.Message): status (google.cloud.compute_v1.types.Snapshot.Status): [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING. - storage_bytes (str): + storage_bytes (int): [Output Only] A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. @@ -21621,13 +21621,13 @@ class StorageBytesStatus(proto.Enum): chain_name = proto.Field(proto.STRING, number=68644169, optional=True,) creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - disk_size_gb = proto.Field(proto.STRING, number=316263735, optional=True,) - download_bytes = proto.Field(proto.STRING, number=435054068, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + disk_size_gb = proto.Field(proto.INT64, number=316263735, optional=True,) + download_bytes = proto.Field(proto.INT64, number=435054068, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) - license_codes = proto.RepeatedField(proto.STRING, number=45482664,) + license_codes = proto.RepeatedField(proto.INT64, number=45482664,) licenses = proto.RepeatedField(proto.STRING, number=337642578,) location_hint = proto.Field(proto.STRING, number=350519505, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -21642,7 +21642,7 @@ class StorageBytesStatus(proto.Enum): ) source_disk_id = proto.Field(proto.STRING, number=454190809, optional=True,) status = proto.Field(proto.ENUM, number=181260274, optional=True, enum=Status,) - storage_bytes = proto.Field(proto.STRING, number=424631719, optional=True,) + storage_bytes = proto.Field(proto.INT64, number=424631719, optional=True,) storage_bytes_status = proto.Field( proto.ENUM, number=490739082, optional=True, enum=StorageBytesStatus, ) @@ -21773,7 +21773,7 @@ class SslCertificate(proto.Message): resource. expire_time (str): [Output Only] Expire time of the certificate. RFC3339 - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -21829,7 +21829,7 @@ class Type(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) expire_time = proto.Field(proto.STRING, number=440691181, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) managed = proto.Field( proto.MESSAGE, @@ -21991,7 +21991,7 @@ class SslPolicy(proto.Message): fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an SslPolicy. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -22052,7 +22052,7 @@ class Profile(proto.Enum): description = proto.Field(proto.STRING, number=422937596, optional=True,) enabled_features = proto.RepeatedField(proto.STRING, number=469017467,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) min_tls_version = proto.Field( proto.ENUM, number=8155943, optional=True, enum=MinTlsVersion, @@ -22300,7 +22300,7 @@ class Subnetwork(proto.Message): gateway_address (str): [Output Only] The gateway address for default routes to reach destination addresses outside this subnetwork. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. ip_cidr_range (str): @@ -22449,7 +22449,7 @@ class State(proto.Enum): enable_flow_logs = proto.Field(proto.BOOL, number=151544420, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) gateway_address = proto.Field(proto.STRING, number=459867385, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ip_cidr_range = proto.Field(proto.STRING, number=98117322, optional=True,) ipv6_cidr_range = proto.Field(proto.STRING, number=273141258, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) @@ -22627,7 +22627,7 @@ class TargetGrpcProxy(proto.Message): conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetGrpcProxy. - id (str): + id (int): [Output Only] The unique identifier for the resource type. The server generates this identifier. kind (str): @@ -22670,7 +22670,7 @@ class TargetGrpcProxy(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) self_link = proto.Field(proto.STRING, number=456214797, optional=True,) @@ -22758,7 +22758,7 @@ class TargetHttpProxy(proto.Message): conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetHttpProxy. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -22801,7 +22801,7 @@ class TargetHttpProxy(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) @@ -22962,7 +22962,7 @@ class TargetHttpsProxy(proto.Message): conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetHttpsProxy. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -23059,7 +23059,7 @@ class QuicOverride(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) fingerprint = proto.Field(proto.STRING, number=234678500, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) @@ -23231,7 +23231,7 @@ class TargetInstance(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. instance (str): @@ -23277,7 +23277,7 @@ class NatPolicy(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) instance = proto.Field(proto.STRING, number=18257045, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -23449,7 +23449,7 @@ class TargetPool(proto.Message): healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. instances (Sequence[str]): @@ -23509,7 +23509,7 @@ class SessionAffinity(proto.Enum): description = proto.Field(proto.STRING, number=422937596, optional=True,) failover_ratio = proto.Field(proto.FLOAT, number=212667006, optional=True,) health_checks = proto.RepeatedField(proto.STRING, number=448370606,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) instances = proto.RepeatedField(proto.STRING, number=29097598,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) @@ -23772,7 +23772,7 @@ class TargetSslProxy(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -23818,7 +23818,7 @@ class ProxyHeader(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) proxy_header = proto.Field( @@ -23917,7 +23917,7 @@ class TargetTcpProxy(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -23966,7 +23966,7 @@ class ProxyHeader(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) proxy_bind = proto.Field(proto.BOOL, number=286025582, optional=True,) @@ -24035,7 +24035,7 @@ class TargetVpnGateway(proto.Message): resources. ForwardingRules are created using compute.forwardingRules.insert and associated with a VPN gateway. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -24083,7 +24083,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) forwarding_rules = proto.RepeatedField(proto.STRING, number=315821365,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) network = proto.Field(proto.STRING, number=232872494, optional=True,) @@ -24727,7 +24727,7 @@ class VpnGateway(proto.Message): An optional description of this resource. Provide this property when you create the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -24774,7 +24774,7 @@ class VpnGateway(proto.Message): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) label_fingerprint = proto.Field(proto.STRING, number=178124825, optional=True,) labels = proto.MapField(proto.STRING, proto.STRING, number=500195327,) @@ -25020,7 +25020,7 @@ class VpnTunnel(proto.Message): resource. detailed_status (str): [Output Only] Detailed status message for the VPN tunnel. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. ike_version (int): @@ -25190,7 +25190,7 @@ class Status(proto.Enum): creation_timestamp = proto.Field(proto.STRING, number=30525366, optional=True,) description = proto.Field(proto.STRING, number=422937596, optional=True,) detailed_status = proto.Field(proto.STRING, number=333501025, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) ike_version = proto.Field(proto.INT32, number=218376220, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) local_traffic_selector = proto.RepeatedField(proto.STRING, number=317314613,) @@ -25387,7 +25387,7 @@ class Zone(proto.Message): zone. description (str): [Output Only] Textual description of the resource. - id (str): + id (int): [Output Only] The unique identifier for the resource. This identifier is defined by the server. kind (str): @@ -25418,7 +25418,7 @@ class Status(proto.Enum): proto.MESSAGE, number=515138995, optional=True, message="DeprecationStatus", ) description = proto.Field(proto.STRING, number=422937596, optional=True,) - id = proto.Field(proto.STRING, number=3355, optional=True,) + id = proto.Field(proto.UINT64, number=3355, optional=True,) kind = proto.Field(proto.STRING, number=3292052, optional=True,) name = proto.Field(proto.STRING, number=3373707, optional=True,) region = proto.Field(proto.STRING, number=138946292, optional=True,) @@ -33046,7 +33046,7 @@ class GetSerialPortOutputInstanceRequest(proto.Message): retrieve data from. project (str): Project ID for this request. - start (str): + start (int): Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to ``0``. @@ -33071,7 +33071,7 @@ class GetSerialPortOutputInstanceRequest(proto.Message): instance = proto.Field(proto.STRING, number=18257045,) port = proto.Field(proto.INT32, number=3446913, optional=True,) project = proto.Field(proto.STRING, number=227560217,) - start = proto.Field(proto.STRING, number=109757538, optional=True,) + start = proto.Field(proto.INT64, number=109757538, optional=True,) zone = proto.Field(proto.STRING, number=3744684,) diff --git a/synth.metadata b/synth.metadata index fd50dfc89..ada408f96 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,7 +11,7 @@ "git": { "name": "googleapis-discovery", "remote": "https://github.com/googleapis/googleapis-discovery.git", - "sha": "abf4cec1ce9e02e4d7d650bf66137c347cdd0d44" + "sha": "c5bb8d324832f638d86bc1348fb45fb3d9c1fb30" } } ], diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index d44fe2349..fba4893f4 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -613,7 +613,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - id="id_value", + id=205, kind="kind_value", maximum_cards_per_instance=2756, name="name_value", @@ -634,7 +634,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.maximum_cards_per_instance == 2756 assert response.name == "name_value" diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index 57d5a84aa..55237d3df 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -582,7 +582,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -594,7 +594,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -618,7 +618,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -630,7 +630,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -705,7 +705,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetAddressReques address_type=compute.Address.AddressType.EXTERNAL, creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, ip_version=compute.Address.IpVersion.IPV4, kind="kind_value", name="name_value", @@ -734,7 +734,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetAddressReques assert response.address_type == compute.Address.AddressType.EXTERNAL assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_version == compute.Address.IpVersion.IPV4 assert response.kind == "kind_value" assert response.name == "name_value" @@ -820,7 +820,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -832,7 +832,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -856,7 +856,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -868,7 +868,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index 1b110ae69..b0f5b9627 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -601,7 +601,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -613,7 +613,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -637,7 +637,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -649,7 +649,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -723,7 +723,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetAutoscalerReq autoscaling_policy=compute.AutoscalingPolicy(cool_down_period_sec=2112), creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", recommended_size=1693, @@ -755,7 +755,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetAutoscalerReq ) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.recommended_size == 1693 @@ -845,7 +845,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -857,7 +857,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -881,7 +881,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -893,7 +893,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1130,7 +1130,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1142,7 +1142,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1166,7 +1166,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1178,7 +1178,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1269,7 +1269,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1281,7 +1281,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1305,7 +1305,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1317,7 +1317,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index e8646d4a8..36c758405 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -441,7 +441,7 @@ def test_add_signed_url_key_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -453,7 +453,7 @@ def test_add_signed_url_key_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -477,7 +477,7 @@ def test_add_signed_url_key_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -489,7 +489,7 @@ def test_add_signed_url_key_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -576,7 +576,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -588,7 +588,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -612,7 +612,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -624,7 +624,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -702,7 +702,7 @@ def test_delete_signed_url_key_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -714,7 +714,7 @@ def test_delete_signed_url_key_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -738,7 +738,7 @@ def test_delete_signed_url_key_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -750,7 +750,7 @@ def test_delete_signed_url_key_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -837,7 +837,7 @@ def test_get_rest( custom_response_headers=["custom_response_headers_value"], description="description_value", enable_cdn=True, - id="id_value", + id=205, kind="kind_value", name="name_value", self_link="self_link_value", @@ -865,7 +865,7 @@ def test_get_rest( assert response.custom_response_headers == ["custom_response_headers_value"] assert response.description == "description_value" assert response.enable_cdn is True - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.self_link == "self_link_value" @@ -940,7 +940,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -952,7 +952,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -976,7 +976,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -988,7 +988,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1204,7 +1204,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1216,7 +1216,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1240,7 +1240,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1252,7 +1252,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1341,7 +1341,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1353,7 +1353,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1377,7 +1377,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1389,7 +1389,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index 392e14875..52f51495d 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -451,7 +451,7 @@ def test_add_signed_url_key_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -463,7 +463,7 @@ def test_add_signed_url_key_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -487,7 +487,7 @@ def test_add_signed_url_key_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -499,7 +499,7 @@ def test_add_signed_url_key_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -747,7 +747,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -759,7 +759,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -783,7 +783,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -795,7 +795,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -874,7 +874,7 @@ def test_delete_signed_url_key_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -886,7 +886,7 @@ def test_delete_signed_url_key_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -910,7 +910,7 @@ def test_delete_signed_url_key_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -922,7 +922,7 @@ def test_delete_signed_url_key_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1026,7 +1026,7 @@ def test_get_rest( fingerprint="fingerprint_value", health_checks=["health_checks_value"], iap=compute.BackendServiceIAP(enabled=True), - id="id_value", + id=205, kind="kind_value", load_balancing_scheme=compute.BackendService.LoadBalancingScheme.EXTERNAL, locality_lb_policy=compute.BackendService.LocalityLbPolicy.INVALID_LB_POLICY, @@ -1091,7 +1091,7 @@ def test_get_rest( assert response.fingerprint == "fingerprint_value" assert response.health_checks == ["health_checks_value"] assert response.iap == compute.BackendServiceIAP(enabled=True) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert ( response.load_balancing_scheme @@ -1289,7 +1289,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1301,7 +1301,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1325,7 +1325,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1337,7 +1337,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1553,7 +1553,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1565,7 +1565,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1589,7 +1589,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1601,7 +1601,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1690,7 +1690,7 @@ def test_set_security_policy_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1702,7 +1702,7 @@ def test_set_security_policy_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1726,7 +1726,7 @@ def test_set_security_policy_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1738,7 +1738,7 @@ def test_set_security_policy_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1829,7 +1829,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1841,7 +1841,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1865,7 +1865,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1877,7 +1877,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index 572461610..c45d542db 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -578,10 +578,10 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetDiskTypeReque # Designate an appropriate value for the returned response. return_value = compute.DiskType( creation_timestamp="creation_timestamp_value", - default_disk_size_gb="default_disk_size_gb_value", + default_disk_size_gb=2097, deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", region="region_value", @@ -601,10 +601,10 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetDiskTypeReque # Establish that the response is the type that we expect. assert isinstance(response, compute.DiskType) assert response.creation_timestamp == "creation_timestamp_value" - assert response.default_disk_size_gb == "default_disk_size_gb_value" + assert response.default_disk_size_gb == 2097 assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.region == "region_value" diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index e8e8a7859..e2ffd150d 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -426,7 +426,7 @@ def test_add_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -438,7 +438,7 @@ def test_add_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -462,7 +462,7 @@ def test_add_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -474,7 +474,7 @@ def test_add_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -718,7 +718,7 @@ def test_create_snapshot_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -730,7 +730,7 @@ def test_create_snapshot_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -754,7 +754,7 @@ def test_create_snapshot_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -766,7 +766,7 @@ def test_create_snapshot_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -854,7 +854,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteDiskReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -866,7 +866,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteDiskReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -890,7 +890,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteDiskReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -902,7 +902,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteDiskReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -983,25 +983,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetDiskRequest): type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ], - id="id_value", + id=205, kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, last_attach_timestamp="last_attach_timestamp_value", last_detach_timestamp="last_detach_timestamp_value", - license_codes=["license_codes_value"], + license_codes=[1360], licenses=["licenses_value"], location_hint="location_hint_value", name="name_value", options="options_value", - physical_block_size_bytes="physical_block_size_bytes_value", - provisioned_iops="provisioned_iops_value", + physical_block_size_bytes=2663, + provisioned_iops=1740, region="region_value", replica_zones=["replica_zones_value"], resource_policies=["resource_policies_value"], satisfies_pzs=True, self_link="self_link_value", - size_gb="size_gb_value", + size_gb=739, source_disk="source_disk_value", source_disk_id="source_disk_id_value", source_image="source_image_value", @@ -1041,25 +1041,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetDiskRequest): type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} assert response.last_attach_timestamp == "last_attach_timestamp_value" assert response.last_detach_timestamp == "last_detach_timestamp_value" - assert response.license_codes == ["license_codes_value"] + assert response.license_codes == [1360] assert response.licenses == ["licenses_value"] assert response.location_hint == "location_hint_value" assert response.name == "name_value" assert response.options == "options_value" - assert response.physical_block_size_bytes == "physical_block_size_bytes_value" - assert response.provisioned_iops == "provisioned_iops_value" + assert response.physical_block_size_bytes == 2663 + assert response.provisioned_iops == 1740 assert response.region == "region_value" assert response.replica_zones == ["replica_zones_value"] assert response.resource_policies == ["resource_policies_value"] assert response.satisfies_pzs is True assert response.self_link == "self_link_value" - assert response.size_gb == "size_gb_value" + assert response.size_gb == 739 assert response.source_disk == "source_disk_value" assert response.source_disk_id == "source_disk_id_value" assert response.source_image == "source_image_value" @@ -1252,7 +1252,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertDiskReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1264,7 +1264,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertDiskReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1288,7 +1288,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertDiskReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1300,7 +1300,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertDiskReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1511,7 +1511,7 @@ def test_remove_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1523,7 +1523,7 @@ def test_remove_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1547,7 +1547,7 @@ def test_remove_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1559,7 +1559,7 @@ def test_remove_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1651,7 +1651,7 @@ def test_resize_rest(transport: str = "rest", request_type=compute.ResizeDiskReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1663,7 +1663,7 @@ def test_resize_rest(transport: str = "rest", request_type=compute.ResizeDiskReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1687,7 +1687,7 @@ def test_resize_rest(transport: str = "rest", request_type=compute.ResizeDiskReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1699,7 +1699,7 @@ def test_resize_rest(transport: str = "rest", request_type=compute.ResizeDiskReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1729,9 +1729,7 @@ def test_resize_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - disks_resize_request_resource = compute.DisksResizeRequest( - size_gb="size_gb_value" - ) + disks_resize_request_resource = compute.DisksResizeRequest(size_gb=739) client.resize( project="project_value", zone="zone_value", @@ -1765,9 +1763,7 @@ def test_resize_rest_flattened_error(): project="project_value", zone="zone_value", disk="disk_value", - disks_resize_request_resource=compute.DisksResizeRequest( - size_gb="size_gb_value" - ), + disks_resize_request_resource=compute.DisksResizeRequest(size_gb=739), ) @@ -1911,7 +1907,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1923,7 +1919,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1947,7 +1943,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1959,7 +1955,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 12dc9631d..7263e0149 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -454,7 +454,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -466,7 +466,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -490,7 +490,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -502,7 +502,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -579,7 +579,7 @@ def test_get_rest( return_value = compute.ExternalVpnGateway( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, interfaces=[compute.ExternalVpnGatewayInterface(id=205)], kind="kind_value", label_fingerprint="label_fingerprint_value", @@ -601,7 +601,7 @@ def test_get_rest( assert isinstance(response, compute.ExternalVpnGateway) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.interfaces == [compute.ExternalVpnGatewayInterface(id=205)] assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" @@ -687,7 +687,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -699,7 +699,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -723,7 +723,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -735,7 +735,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -972,7 +972,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -984,7 +984,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1008,7 +1008,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1020,7 +1020,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index eac449dc8..e1df9a395 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -452,7 +452,7 @@ def test_add_association_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_add_association_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_add_association_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_add_association_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -588,7 +588,7 @@ def test_add_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -600,7 +600,7 @@ def test_add_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -624,7 +624,7 @@ def test_add_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -636,7 +636,7 @@ def test_add_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -724,7 +724,7 @@ def test_clone_rules_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -736,7 +736,7 @@ def test_clone_rules_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -760,7 +760,7 @@ def test_clone_rules_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -772,7 +772,7 @@ def test_clone_rules_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -846,7 +846,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -858,7 +858,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -882,7 +882,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -894,7 +894,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -970,7 +970,7 @@ def test_get_rest( description="description_value", display_name="display_name_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", parent="parent_value", @@ -998,7 +998,7 @@ def test_get_rest( assert response.description == "description_value" assert response.display_name == "display_name_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.parent == "parent_value" @@ -1350,7 +1350,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1362,7 +1362,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1386,7 +1386,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1398,7 +1398,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1713,7 +1713,7 @@ def test_move_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1725,7 +1725,7 @@ def test_move_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1749,7 +1749,7 @@ def test_move_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1761,7 +1761,7 @@ def test_move_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1835,7 +1835,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1847,7 +1847,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1871,7 +1871,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1883,7 +1883,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1979,7 +1979,7 @@ def test_patch_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1991,7 +1991,7 @@ def test_patch_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2015,7 +2015,7 @@ def test_patch_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2027,7 +2027,7 @@ def test_patch_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2115,7 +2115,7 @@ def test_remove_association_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2127,7 +2127,7 @@ def test_remove_association_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2151,7 +2151,7 @@ def test_remove_association_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2163,7 +2163,7 @@ def test_remove_association_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2237,7 +2237,7 @@ def test_remove_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2249,7 +2249,7 @@ def test_remove_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2273,7 +2273,7 @@ def test_remove_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2285,7 +2285,7 @@ def test_remove_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index 6c04cf87a..60d80b867 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -429,7 +429,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -553,7 +553,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetFirewallReque destination_ranges=["destination_ranges_value"], direction=compute.Firewall.Direction.EGRESS, disabled=True, - id="id_value", + id=205, kind="kind_value", log_config=compute.FirewallLogConfig(enable=True), name="name_value", @@ -584,7 +584,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetFirewallReque assert response.destination_ranges == ["destination_ranges_value"] assert response.direction == compute.Firewall.Direction.EGRESS assert response.disabled is True - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.log_config == compute.FirewallLogConfig(enable=True) assert response.name == "name_value" @@ -667,7 +667,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -679,7 +679,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -703,7 +703,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -715,7 +715,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -927,7 +927,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchFirewallR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -939,7 +939,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchFirewallR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -963,7 +963,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchFirewallR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -975,7 +975,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchFirewallR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1066,7 +1066,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1078,7 +1078,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1102,7 +1102,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1114,7 +1114,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 80ae0e680..3ff331a48 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -612,7 +612,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -624,7 +624,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -648,7 +648,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -660,7 +660,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -743,7 +743,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, ip_version=compute.ForwardingRule.IpVersion.IPV4, is_mirroring_collector=True, kind="kind_value", @@ -760,7 +760,7 @@ def test_get_rest( network_tier=compute.ForwardingRule.NetworkTier.PREMIUM, port_range="port_range_value", ports=["ports_value"], - psc_connection_id="psc_connection_id_value", + psc_connection_id=1793, region="region_value", self_link="self_link_value", service_directory_registrations=[ @@ -792,7 +792,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_version == compute.ForwardingRule.IpVersion.IPV4 assert response.is_mirroring_collector is True assert response.kind == "kind_value" @@ -812,7 +812,7 @@ def test_get_rest( assert response.network_tier == compute.ForwardingRule.NetworkTier.PREMIUM assert response.port_range == "port_range_value" assert response.ports == ["ports_value"] - assert response.psc_connection_id == "psc_connection_id_value" + assert response.psc_connection_id == 1793 assert response.region == "region_value" assert response.self_link == "self_link_value" assert response.service_directory_registrations == [ @@ -897,7 +897,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -909,7 +909,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -933,7 +933,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -945,7 +945,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1172,7 +1172,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1184,7 +1184,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1208,7 +1208,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1220,7 +1220,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1314,7 +1314,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1326,7 +1326,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1350,7 +1350,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1362,7 +1362,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1456,7 +1456,7 @@ def test_set_target_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1468,7 +1468,7 @@ def test_set_target_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1492,7 +1492,7 @@ def test_set_target_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1504,7 +1504,7 @@ def test_set_target_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index 515934638..f20e82e75 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -451,7 +451,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -463,7 +463,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -487,7 +487,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -499,7 +499,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -574,7 +574,7 @@ def test_get_rest( address_type=compute.Address.AddressType.EXTERNAL, creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, ip_version=compute.Address.IpVersion.IPV4, kind="kind_value", name="name_value", @@ -603,7 +603,7 @@ def test_get_rest( assert response.address_type == compute.Address.AddressType.EXTERNAL assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_version == compute.Address.IpVersion.IPV4 assert response.kind == "kind_value" assert response.name == "name_value" @@ -687,7 +687,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -699,7 +699,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -723,7 +723,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -735,7 +735,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index 300156af3..1e6dc4852 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -472,7 +472,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -484,7 +484,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -508,7 +508,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -520,7 +520,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -603,7 +603,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, ip_version=compute.ForwardingRule.IpVersion.IPV4, is_mirroring_collector=True, kind="kind_value", @@ -620,7 +620,7 @@ def test_get_rest( network_tier=compute.ForwardingRule.NetworkTier.PREMIUM, port_range="port_range_value", ports=["ports_value"], - psc_connection_id="psc_connection_id_value", + psc_connection_id=1793, region="region_value", self_link="self_link_value", service_directory_registrations=[ @@ -652,7 +652,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_version == compute.ForwardingRule.IpVersion.IPV4 assert response.is_mirroring_collector is True assert response.kind == "kind_value" @@ -672,7 +672,7 @@ def test_get_rest( assert response.network_tier == compute.ForwardingRule.NetworkTier.PREMIUM assert response.port_range == "port_range_value" assert response.ports == ["ports_value"] - assert response.psc_connection_id == "psc_connection_id_value" + assert response.psc_connection_id == 1793 assert response.region == "region_value" assert response.self_link == "self_link_value" assert response.service_directory_registrations == [ @@ -757,7 +757,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -769,7 +769,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -793,7 +793,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -805,7 +805,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1033,7 +1033,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1045,7 +1045,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1069,7 +1069,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1081,7 +1081,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1176,7 +1176,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1188,7 +1188,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1212,7 +1212,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1224,7 +1224,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1319,7 +1319,7 @@ def test_set_target_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1331,7 +1331,7 @@ def test_set_target_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1355,7 +1355,7 @@ def test_set_target_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1367,7 +1367,7 @@ def test_set_target_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 34c09c35c..7fbc42ae8 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -481,7 +481,7 @@ def test_attach_network_endpoints_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -493,7 +493,7 @@ def test_attach_network_endpoints_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -517,7 +517,7 @@ def test_attach_network_endpoints_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -529,7 +529,7 @@ def test_attach_network_endpoints_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -629,7 +629,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -641,7 +641,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -665,7 +665,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -677,7 +677,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -761,7 +761,7 @@ def test_detach_network_endpoints_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -773,7 +773,7 @@ def test_detach_network_endpoints_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -797,7 +797,7 @@ def test_detach_network_endpoints_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -809,7 +809,7 @@ def test_detach_network_endpoints_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -910,7 +910,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", default_port=1289, description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", network="network_value", @@ -945,7 +945,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.default_port == 1289 assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network == "network_value" @@ -1035,7 +1035,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1047,7 +1047,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1071,7 +1071,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1083,7 +1083,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index 6656b4709..a8e56b8aa 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -686,7 +686,7 @@ def test_get_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -698,7 +698,7 @@ def test_get_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -722,7 +722,7 @@ def test_get_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -734,7 +734,7 @@ def test_get_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -937,7 +937,7 @@ def test_wait_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -949,7 +949,7 @@ def test_wait_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -973,7 +973,7 @@ def test_wait_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -985,7 +985,7 @@ def test_wait_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index 59bb119a6..b766a1830 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -560,7 +560,7 @@ def test_get_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -572,7 +572,7 @@ def test_get_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -596,7 +596,7 @@ def test_get_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -608,7 +608,7 @@ def test_get_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index 97aa2bd68..9d6ed1edf 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -487,7 +487,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -499,7 +499,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -523,7 +523,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -535,7 +535,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -614,7 +614,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, ip_cidr_range="ip_cidr_range_value", is_live_migration=True, kind="kind_value", @@ -643,7 +643,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_cidr_range == "ip_cidr_range_value" assert response.is_live_migration is True assert response.kind == "kind_value" @@ -734,7 +734,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -746,7 +746,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -770,7 +770,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -782,7 +782,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1022,7 +1022,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1034,7 +1034,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1058,7 +1058,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1070,7 +1070,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index b6a2cfc00..3b650dcdf 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -591,7 +591,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -603,7 +603,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -627,7 +627,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -639,7 +639,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -718,7 +718,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetHealthCheckRe http2_health_check=compute.HTTP2HealthCheck(host="host_value"), http_health_check=compute.HTTPHealthCheck(host="host_value"), https_health_check=compute.HTTPSHealthCheck(host="host_value"), - id="id_value", + id=205, kind="kind_value", log_config=compute.HealthCheckLogConfig(enable=True), name="name_value", @@ -751,7 +751,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetHealthCheckRe assert response.http2_health_check == compute.HTTP2HealthCheck(host="host_value") assert response.http_health_check == compute.HTTPHealthCheck(host="host_value") assert response.https_health_check == compute.HTTPSHealthCheck(host="host_value") - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.log_config == compute.HealthCheckLogConfig(enable=True) assert response.name == "name_value" @@ -833,7 +833,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -845,7 +845,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -869,7 +869,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -881,7 +881,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1095,7 +1095,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1107,7 +1107,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1131,7 +1131,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1143,7 +1143,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1230,7 +1230,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1242,7 +1242,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1266,7 +1266,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1278,7 +1278,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index 9baaa6f7a..90e6c161a 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -424,7 +424,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteImageRe error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -436,7 +436,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteImageRe start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -460,7 +460,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteImageRe assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -472,7 +472,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteImageRe assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -548,7 +548,7 @@ def test_deprecate_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -560,7 +560,7 @@ def test_deprecate_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -584,7 +584,7 @@ def test_deprecate_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -596,7 +596,7 @@ def test_deprecate_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -676,25 +676,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetImageRequest) with mock.patch.object(Session, "request") as req: # Designate an appropriate value for the returned response. return_value = compute.Image( - archive_size_bytes="archive_size_bytes_value", + archive_size_bytes=1922, creation_timestamp="creation_timestamp_value", deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - disk_size_gb="disk_size_gb_value", + disk_size_gb=1261, family="family_value", guest_os_features=[ compute.GuestOsFeature( type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ], - id="id_value", + id=205, image_encryption_key=compute.CustomerEncryptionKey( kms_key_name="kms_key_name_value" ), kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, - license_codes=["license_codes_value"], + license_codes=[1360], licenses=["licenses_value"], name="name_value", raw_disk=compute.RawDisk(container_type=compute.RawDisk.ContainerType.TAR), @@ -733,25 +733,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetImageRequest) # Establish that the response is the type that we expect. assert isinstance(response, compute.Image) - assert response.archive_size_bytes == "archive_size_bytes_value" + assert response.archive_size_bytes == 1922 assert response.creation_timestamp == "creation_timestamp_value" assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.disk_size_gb == "disk_size_gb_value" + assert response.disk_size_gb == 1261 assert response.family == "family_value" assert response.guest_os_features == [ compute.GuestOsFeature( type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ] - assert response.id == "id_value" + assert response.id == 205 assert response.image_encryption_key == compute.CustomerEncryptionKey( kms_key_name="kms_key_name_value" ) assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} - assert response.license_codes == ["license_codes_value"] + assert response.license_codes == [1360] assert response.licenses == ["licenses_value"] assert response.name == "name_value" assert response.raw_disk == compute.RawDisk( @@ -842,25 +842,25 @@ def test_get_from_family_rest( with mock.patch.object(Session, "request") as req: # Designate an appropriate value for the returned response. return_value = compute.Image( - archive_size_bytes="archive_size_bytes_value", + archive_size_bytes=1922, creation_timestamp="creation_timestamp_value", deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - disk_size_gb="disk_size_gb_value", + disk_size_gb=1261, family="family_value", guest_os_features=[ compute.GuestOsFeature( type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ], - id="id_value", + id=205, image_encryption_key=compute.CustomerEncryptionKey( kms_key_name="kms_key_name_value" ), kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, - license_codes=["license_codes_value"], + license_codes=[1360], licenses=["licenses_value"], name="name_value", raw_disk=compute.RawDisk(container_type=compute.RawDisk.ContainerType.TAR), @@ -899,25 +899,25 @@ def test_get_from_family_rest( # Establish that the response is the type that we expect. assert isinstance(response, compute.Image) - assert response.archive_size_bytes == "archive_size_bytes_value" + assert response.archive_size_bytes == 1922 assert response.creation_timestamp == "creation_timestamp_value" assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.disk_size_gb == "disk_size_gb_value" + assert response.disk_size_gb == 1261 assert response.family == "family_value" assert response.guest_os_features == [ compute.GuestOsFeature( type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ] - assert response.id == "id_value" + assert response.id == 205 assert response.image_encryption_key == compute.CustomerEncryptionKey( kms_key_name="kms_key_name_value" ) assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} - assert response.license_codes == ["license_codes_value"] + assert response.license_codes == [1360] assert response.licenses == ["licenses_value"] assert response.name == "name_value" assert response.raw_disk == compute.RawDisk( @@ -1117,7 +1117,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertImageRe error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1129,7 +1129,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertImageRe start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1153,7 +1153,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertImageRe assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1165,7 +1165,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertImageRe assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1195,7 +1195,7 @@ def test_insert_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - image_resource = compute.Image(archive_size_bytes="archive_size_bytes_value") + image_resource = compute.Image(archive_size_bytes=1922) client.insert( project="project_value", image_resource=image_resource, ) @@ -1222,7 +1222,7 @@ def test_insert_rest_flattened_error(): client.insert( compute.InsertImageRequest(), project="project_value", - image_resource=compute.Image(archive_size_bytes="archive_size_bytes_value"), + image_resource=compute.Image(archive_size_bytes=1922), ) @@ -1240,7 +1240,7 @@ def test_list_rest(transport: str = "rest", request_type=compute.ListImagesReque # Designate an appropriate value for the returned response. return_value = compute.ImageList( id="id_value", - items=[compute.Image(archive_size_bytes="archive_size_bytes_value")], + items=[compute.Image(archive_size_bytes=1922)], kind="kind_value", next_page_token="next_page_token_value", self_link="self_link_value", @@ -1258,9 +1258,7 @@ def test_list_rest(transport: str = "rest", request_type=compute.ListImagesReque # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListPager) assert response.id == "id_value" - assert response.items == [ - compute.Image(archive_size_bytes="archive_size_bytes_value") - ] + assert response.items == [compute.Image(archive_size_bytes=1922)] assert response.kind == "kind_value" assert response.next_page_token == "next_page_token_value" assert response.self_link == "self_link_value" @@ -1369,7 +1367,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchImageRequ error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1381,7 +1379,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchImageRequ start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1405,7 +1403,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchImageRequ assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1417,7 +1415,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchImageRequ assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1447,7 +1445,7 @@ def test_patch_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - image_resource = compute.Image(archive_size_bytes="archive_size_bytes_value") + image_resource = compute.Image(archive_size_bytes=1922) client.patch( project="project_value", image="image_value", image_resource=image_resource, ) @@ -1476,7 +1474,7 @@ def test_patch_rest_flattened_error(): compute.PatchImageRequest(), project="project_value", image="image_value", - image_resource=compute.Image(archive_size_bytes="archive_size_bytes_value"), + image_resource=compute.Image(archive_size_bytes=1922), ) @@ -1617,7 +1615,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1629,7 +1627,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1653,7 +1651,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1665,7 +1663,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index de038d81c..3f37da126 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -473,7 +473,7 @@ def test_abandon_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -485,7 +485,7 @@ def test_abandon_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -509,7 +509,7 @@ def test_abandon_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -521,7 +521,7 @@ def test_abandon_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -809,7 +809,7 @@ def test_apply_updates_to_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -821,7 +821,7 @@ def test_apply_updates_to_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -845,7 +845,7 @@ def test_apply_updates_to_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -857,7 +857,7 @@ def test_apply_updates_to_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -956,7 +956,7 @@ def test_create_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -968,7 +968,7 @@ def test_create_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -992,7 +992,7 @@ def test_create_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1004,7 +1004,7 @@ def test_create_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1102,7 +1102,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1114,7 +1114,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1138,7 +1138,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1150,7 +1150,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1237,7 +1237,7 @@ def test_delete_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1249,7 +1249,7 @@ def test_delete_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1273,7 +1273,7 @@ def test_delete_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1285,7 +1285,7 @@ def test_delete_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1384,7 +1384,7 @@ def test_delete_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1396,7 +1396,7 @@ def test_delete_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1420,7 +1420,7 @@ def test_delete_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1432,7 +1432,7 @@ def test_delete_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1536,7 +1536,7 @@ def test_get_rest( target_shape=compute.DistributionPolicy.TargetShape.ANY ), fingerprint="fingerprint_value", - id="id_value", + id=205, instance_group="instance_group_value", instance_template="instance_template_value", kind="kind_value", @@ -1590,7 +1590,7 @@ def test_get_rest( target_shape=compute.DistributionPolicy.TargetShape.ANY ) assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.instance_group == "instance_group_value" assert response.instance_template == "instance_template_value" assert response.kind == "kind_value" @@ -1698,7 +1698,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1710,7 +1710,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1734,7 +1734,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1746,7 +1746,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2479,7 +2479,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2491,7 +2491,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2515,7 +2515,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2527,7 +2527,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2634,7 +2634,7 @@ def test_patch_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2646,7 +2646,7 @@ def test_patch_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2670,7 +2670,7 @@ def test_patch_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2682,7 +2682,7 @@ def test_patch_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2785,7 +2785,7 @@ def test_recreate_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2797,7 +2797,7 @@ def test_recreate_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2821,7 +2821,7 @@ def test_recreate_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2833,7 +2833,7 @@ def test_recreate_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2931,7 +2931,7 @@ def test_resize_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2943,7 +2943,7 @@ def test_resize_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2967,7 +2967,7 @@ def test_resize_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2979,7 +2979,7 @@ def test_resize_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3069,7 +3069,7 @@ def test_set_instance_template_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3081,7 +3081,7 @@ def test_set_instance_template_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3105,7 +3105,7 @@ def test_set_instance_template_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3117,7 +3117,7 @@ def test_set_instance_template_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3216,7 +3216,7 @@ def test_set_target_pools_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3228,7 +3228,7 @@ def test_set_target_pools_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3252,7 +3252,7 @@ def test_set_target_pools_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3264,7 +3264,7 @@ def test_set_target_pools_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3363,7 +3363,7 @@ def test_update_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3375,7 +3375,7 @@ def test_update_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3399,7 +3399,7 @@ def test_update_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3411,7 +3411,7 @@ def test_update_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index 921515906..2f41794b5 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -441,7 +441,7 @@ def test_add_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -453,7 +453,7 @@ def test_add_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -477,7 +477,7 @@ def test_add_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -489,7 +489,7 @@ def test_add_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -747,7 +747,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -759,7 +759,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -783,7 +783,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -795,7 +795,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -873,7 +873,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", named_ports=[compute.NamedPort(name="name_value")], @@ -898,7 +898,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.named_ports == [compute.NamedPort(name="name_value")] @@ -983,7 +983,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -995,7 +995,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1019,7 +1019,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1031,7 +1031,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1419,7 +1419,7 @@ def test_remove_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1431,7 +1431,7 @@ def test_remove_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1455,7 +1455,7 @@ def test_remove_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1467,7 +1467,7 @@ def test_remove_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1561,7 +1561,7 @@ def test_set_named_ports_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1573,7 +1573,7 @@ def test_set_named_ports_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1597,7 +1597,7 @@ def test_set_named_ports_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1609,7 +1609,7 @@ def test_set_named_ports_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index 38a33ea1c..f1c957eec 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -452,7 +452,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -573,7 +573,7 @@ def test_get_rest( return_value = compute.InstanceTemplate( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", properties=compute.InstanceProperties( @@ -600,7 +600,7 @@ def test_get_rest( assert isinstance(response, compute.InstanceTemplate) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.properties == compute.InstanceProperties( @@ -786,7 +786,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -798,7 +798,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -822,7 +822,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -834,7 +834,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index c01e713eb..a8d0c3c42 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -429,7 +429,7 @@ def test_add_access_config_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_add_access_config_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_add_access_config_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_add_access_config_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -570,7 +570,7 @@ def test_add_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -582,7 +582,7 @@ def test_add_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -606,7 +606,7 @@ def test_add_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -618,7 +618,7 @@ def test_add_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -877,7 +877,7 @@ def test_attach_disk_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -889,7 +889,7 @@ def test_attach_disk_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -913,7 +913,7 @@ def test_attach_disk_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -925,7 +925,7 @@ def test_attach_disk_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1015,7 +1015,7 @@ def test_bulk_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1027,7 +1027,7 @@ def test_bulk_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1051,7 +1051,7 @@ def test_bulk_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1063,7 +1063,7 @@ def test_bulk_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1094,7 +1094,7 @@ def test_bulk_insert_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. bulk_insert_instance_resource_resource = compute.BulkInsertInstanceResource( - count="count_value" + count=553 ) client.bulk_insert( project="project_value", @@ -1127,7 +1127,7 @@ def test_bulk_insert_rest_flattened_error(): project="project_value", zone="zone_value", bulk_insert_instance_resource_resource=compute.BulkInsertInstanceResource( - count="count_value" + count=553 ), ) @@ -1154,7 +1154,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1166,7 +1166,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1190,7 +1190,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1202,7 +1202,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1282,7 +1282,7 @@ def test_delete_access_config_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1294,7 +1294,7 @@ def test_delete_access_config_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1318,7 +1318,7 @@ def test_delete_access_config_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1330,7 +1330,7 @@ def test_delete_access_config_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1418,7 +1418,7 @@ def test_detach_disk_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1430,7 +1430,7 @@ def test_detach_disk_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1454,7 +1454,7 @@ def test_detach_disk_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1466,7 +1466,7 @@ def test_detach_disk_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1558,7 +1558,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetInstanceReque fingerprint="fingerprint_value", guest_accelerators=[compute.AcceleratorConfig(accelerator_count=1805)], hostname="hostname_value", - id="id_value", + id=205, kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, @@ -1624,7 +1624,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetInstanceReque compute.AcceleratorConfig(accelerator_count=1805) ] assert response.hostname == "hostname_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} @@ -2114,9 +2114,9 @@ def test_get_serial_port_output_rest( return_value = compute.SerialPortOutput( contents="contents_value", kind="kind_value", - next_="next__value", + next_=542, self_link="self_link_value", - start="start_value", + start=558, ) # Wrap the value into a proper Response obj @@ -2131,9 +2131,9 @@ def test_get_serial_port_output_rest( assert isinstance(response, compute.SerialPortOutput) assert response.contents == "contents_value" assert response.kind == "kind_value" - assert response.next_ == "next__value" + assert response.next_ == 542 assert response.self_link == "self_link_value" - assert response.start == "start_value" + assert response.start == 558 def test_get_serial_port_output_rest_from_dict(): @@ -2298,7 +2298,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2310,7 +2310,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2334,7 +2334,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2346,7 +2346,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2711,7 +2711,7 @@ def test_remove_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2723,7 +2723,7 @@ def test_remove_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2747,7 +2747,7 @@ def test_remove_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2759,7 +2759,7 @@ def test_remove_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2851,7 +2851,7 @@ def test_reset_rest(transport: str = "rest", request_type=compute.ResetInstanceR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2863,7 +2863,7 @@ def test_reset_rest(transport: str = "rest", request_type=compute.ResetInstanceR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2887,7 +2887,7 @@ def test_reset_rest(transport: str = "rest", request_type=compute.ResetInstanceR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2899,7 +2899,7 @@ def test_reset_rest(transport: str = "rest", request_type=compute.ResetInstanceR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2979,7 +2979,7 @@ def test_set_deletion_protection_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2991,7 +2991,7 @@ def test_set_deletion_protection_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3015,7 +3015,7 @@ def test_set_deletion_protection_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3027,7 +3027,7 @@ def test_set_deletion_protection_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3107,7 +3107,7 @@ def test_set_disk_auto_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3119,7 +3119,7 @@ def test_set_disk_auto_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3143,7 +3143,7 @@ def test_set_disk_auto_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3155,7 +3155,7 @@ def test_set_disk_auto_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3361,7 +3361,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3373,7 +3373,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3397,7 +3397,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3409,7 +3409,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3503,7 +3503,7 @@ def test_set_machine_resources_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3515,7 +3515,7 @@ def test_set_machine_resources_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3539,7 +3539,7 @@ def test_set_machine_resources_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3551,7 +3551,7 @@ def test_set_machine_resources_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3645,7 +3645,7 @@ def test_set_machine_type_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3657,7 +3657,7 @@ def test_set_machine_type_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3681,7 +3681,7 @@ def test_set_machine_type_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3693,7 +3693,7 @@ def test_set_machine_type_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3787,7 +3787,7 @@ def test_set_metadata_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3799,7 +3799,7 @@ def test_set_metadata_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3823,7 +3823,7 @@ def test_set_metadata_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3835,7 +3835,7 @@ def test_set_metadata_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3925,7 +3925,7 @@ def test_set_min_cpu_platform_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3937,7 +3937,7 @@ def test_set_min_cpu_platform_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3961,7 +3961,7 @@ def test_set_min_cpu_platform_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3973,7 +3973,7 @@ def test_set_min_cpu_platform_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4067,7 +4067,7 @@ def test_set_scheduling_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4079,7 +4079,7 @@ def test_set_scheduling_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4103,7 +4103,7 @@ def test_set_scheduling_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4115,7 +4115,7 @@ def test_set_scheduling_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4205,7 +4205,7 @@ def test_set_service_account_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4217,7 +4217,7 @@ def test_set_service_account_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4241,7 +4241,7 @@ def test_set_service_account_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4253,7 +4253,7 @@ def test_set_service_account_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4348,7 +4348,7 @@ def test_set_shielded_instance_integrity_policy_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4360,7 +4360,7 @@ def test_set_shielded_instance_integrity_policy_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4384,7 +4384,7 @@ def test_set_shielded_instance_integrity_policy_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4396,7 +4396,7 @@ def test_set_shielded_instance_integrity_policy_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4490,7 +4490,7 @@ def test_set_tags_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4502,7 +4502,7 @@ def test_set_tags_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4526,7 +4526,7 @@ def test_set_tags_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4538,7 +4538,7 @@ def test_set_tags_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4629,7 +4629,7 @@ def test_simulate_maintenance_event_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4641,7 +4641,7 @@ def test_simulate_maintenance_event_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4665,7 +4665,7 @@ def test_simulate_maintenance_event_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4677,7 +4677,7 @@ def test_simulate_maintenance_event_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4755,7 +4755,7 @@ def test_start_rest(transport: str = "rest", request_type=compute.StartInstanceR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4767,7 +4767,7 @@ def test_start_rest(transport: str = "rest", request_type=compute.StartInstanceR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4791,7 +4791,7 @@ def test_start_rest(transport: str = "rest", request_type=compute.StartInstanceR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4803,7 +4803,7 @@ def test_start_rest(transport: str = "rest", request_type=compute.StartInstanceR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -4883,7 +4883,7 @@ def test_start_with_encryption_key_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -4895,7 +4895,7 @@ def test_start_with_encryption_key_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -4919,7 +4919,7 @@ def test_start_with_encryption_key_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -4931,7 +4931,7 @@ def test_start_with_encryption_key_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5035,7 +5035,7 @@ def test_stop_rest(transport: str = "rest", request_type=compute.StopInstanceReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5047,7 +5047,7 @@ def test_stop_rest(transport: str = "rest", request_type=compute.StopInstanceReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5071,7 +5071,7 @@ def test_stop_rest(transport: str = "rest", request_type=compute.StopInstanceReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5083,7 +5083,7 @@ def test_stop_rest(transport: str = "rest", request_type=compute.StopInstanceReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5257,7 +5257,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5269,7 +5269,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5293,7 +5293,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5305,7 +5305,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5403,7 +5403,7 @@ def test_update_access_config_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5415,7 +5415,7 @@ def test_update_access_config_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5439,7 +5439,7 @@ def test_update_access_config_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5451,7 +5451,7 @@ def test_update_access_config_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5544,7 +5544,7 @@ def test_update_display_device_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5556,7 +5556,7 @@ def test_update_display_device_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5580,7 +5580,7 @@ def test_update_display_device_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5592,7 +5592,7 @@ def test_update_display_device_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5682,7 +5682,7 @@ def test_update_network_interface_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5694,7 +5694,7 @@ def test_update_network_interface_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5718,7 +5718,7 @@ def test_update_network_interface_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5730,7 +5730,7 @@ def test_update_network_interface_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -5828,7 +5828,7 @@ def test_update_shielded_instance_config_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -5840,7 +5840,7 @@ def test_update_shielded_instance_config_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -5864,7 +5864,7 @@ def test_update_shielded_instance_config_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -5876,7 +5876,7 @@ def test_update_shielded_instance_config_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 9e7a17aad..1eaa5f3a6 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -649,7 +649,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -661,7 +661,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -685,7 +685,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -697,7 +697,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -787,7 +787,7 @@ def test_get_rest( edge_availability_domain=compute.InterconnectAttachment.EdgeAvailabilityDomain.AVAILABILITY_DOMAIN_1, encryption=compute.InterconnectAttachment.Encryption.IPSEC, google_reference_id="google_reference_id_value", - id="id_value", + id=205, interconnect="interconnect_value", ipsec_internal_addresses=["ipsec_internal_addresses_value"], kind="kind_value", @@ -795,7 +795,7 @@ def test_get_rest( name="name_value", operational_status=compute.InterconnectAttachment.OperationalStatus.OS_ACTIVE, pairing_key="pairing_key_value", - partner_asn="partner_asn_value", + partner_asn=1181, partner_metadata=compute.InterconnectAttachmentPartnerMetadata( interconnect_name="interconnect_name_value" ), @@ -834,7 +834,7 @@ def test_get_rest( ) assert response.encryption == compute.InterconnectAttachment.Encryption.IPSEC assert response.google_reference_id == "google_reference_id_value" - assert response.id == "id_value" + assert response.id == 205 assert response.interconnect == "interconnect_value" assert response.ipsec_internal_addresses == ["ipsec_internal_addresses_value"] assert response.kind == "kind_value" @@ -845,7 +845,7 @@ def test_get_rest( == compute.InterconnectAttachment.OperationalStatus.OS_ACTIVE ) assert response.pairing_key == "pairing_key_value" - assert response.partner_asn == "partner_asn_value" + assert response.partner_asn == 1181 assert response.partner_metadata == compute.InterconnectAttachmentPartnerMetadata( interconnect_name="interconnect_name_value" ) @@ -938,7 +938,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -950,7 +950,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -974,7 +974,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -986,7 +986,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1228,7 +1228,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1240,7 +1240,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1264,7 +1264,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1276,7 +1276,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index 357d4718f..1dd797a60 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -473,15 +473,11 @@ def test_get_rest( description="description_value", facility_provider="facility_provider_value", facility_provider_facility_id="facility_provider_facility_id_value", - id="id_value", + id=205, kind="kind_value", name="name_value", peeringdb_facility_id="peeringdb_facility_id_value", - region_infos=[ - compute.InterconnectLocationRegionInfo( - expected_rtt_ms="expected_rtt_ms_value" - ) - ], + region_infos=[compute.InterconnectLocationRegionInfo(expected_rtt_ms=1610)], self_link="self_link_value", status=compute.InterconnectLocation.Status.AVAILABLE, ) @@ -506,12 +502,12 @@ def test_get_rest( assert ( response.facility_provider_facility_id == "facility_provider_facility_id_value" ) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.peeringdb_facility_id == "peeringdb_facility_id_value" assert response.region_infos == [ - compute.InterconnectLocationRegionInfo(expected_rtt_ms="expected_rtt_ms_value") + compute.InterconnectLocationRegionInfo(expected_rtt_ms=1610) ] assert response.self_link == "self_link_value" assert response.status == compute.InterconnectLocation.Status.AVAILABLE diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index 25566abe7..04421e416 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -440,7 +440,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -452,7 +452,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -476,7 +476,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -488,7 +488,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -573,7 +573,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetInterconnectR ], google_ip_address="google_ip_address_value", google_reference_id="google_reference_id_value", - id="id_value", + id=205, interconnect_attachments=["interconnect_attachments_value"], interconnect_type=compute.Interconnect.InterconnectType.DEDICATED, kind="kind_value", @@ -613,7 +613,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetInterconnectR ] assert response.google_ip_address == "google_ip_address_value" assert response.google_reference_id == "google_reference_id_value" - assert response.id == "id_value" + assert response.id == 205 assert response.interconnect_attachments == ["interconnect_attachments_value"] assert response.interconnect_type == compute.Interconnect.InterconnectType.DEDICATED assert response.kind == "kind_value" @@ -794,7 +794,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -806,7 +806,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -830,7 +830,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -842,7 +842,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1056,7 +1056,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1068,7 +1068,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1092,7 +1092,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1104,7 +1104,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index 868ad5c72..06804cff5 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -425,7 +425,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetLicenseCodeRe return_value = compute.LicenseCode( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", license_alias=[ compute.LicenseCodeLicenseAlias(description="description_value") @@ -448,7 +448,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetLicenseCodeRe assert isinstance(response, compute.LicenseCode) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.license_alias == [ compute.LicenseCodeLicenseAlias(description="description_value") diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index dc4e7289c..d488414ff 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -429,7 +429,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -549,9 +549,9 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetLicenseReques charges_use_fee=True, creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", - license_code="license_code_value", + license_code=1245, name="name_value", resource_requirements=compute.LicenseResourceRequirements( min_guest_cpu_count=2042 @@ -573,9 +573,9 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetLicenseReques assert response.charges_use_fee is True assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" - assert response.license_code == "license_code_value" + assert response.license_code == 1245 assert response.name == "name_value" assert response.resource_requirements == compute.LicenseResourceRequirements( min_guest_cpu_count=2042 @@ -755,7 +755,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -767,7 +767,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -791,7 +791,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -803,7 +803,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index 17155d46a..a473b5a0b 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -595,12 +595,12 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetMachineTypeRe deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", guest_cpus=1090, - id="id_value", + id=205, image_space_gb=1430, is_shared_cpu=True, kind="kind_value", maximum_persistent_disks=2603, - maximum_persistent_disks_size_gb="maximum_persistent_disks_size_gb_value", + maximum_persistent_disks_size_gb=3437, memory_mb=967, name="name_value", scratch_disks=[compute.ScratchDisks(disk_gb=723)], @@ -623,15 +623,12 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetMachineTypeRe assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" assert response.guest_cpus == 1090 - assert response.id == "id_value" + assert response.id == 205 assert response.image_space_gb == 1430 assert response.is_shared_cpu is True assert response.kind == "kind_value" assert response.maximum_persistent_disks == 2603 - assert ( - response.maximum_persistent_disks_size_gb - == "maximum_persistent_disks_size_gb_value" - ) + assert response.maximum_persistent_disks_size_gb == 3437 assert response.memory_mb == 967 assert response.name == "name_value" assert response.scratch_disks == [compute.ScratchDisks(disk_gb=723)] diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index 5f9f6d7f3..6f2b5a067 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -652,7 +652,7 @@ def test_attach_network_endpoints_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -664,7 +664,7 @@ def test_attach_network_endpoints_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -688,7 +688,7 @@ def test_attach_network_endpoints_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -700,7 +700,7 @@ def test_attach_network_endpoints_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -802,7 +802,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -814,7 +814,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -838,7 +838,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -850,7 +850,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -937,7 +937,7 @@ def test_detach_network_endpoints_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -949,7 +949,7 @@ def test_detach_network_endpoints_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -973,7 +973,7 @@ def test_detach_network_endpoints_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -985,7 +985,7 @@ def test_detach_network_endpoints_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1089,7 +1089,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", default_port=1289, description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", network="network_value", @@ -1124,7 +1124,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.default_port == 1289 assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network == "network_value" @@ -1216,7 +1216,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1228,7 +1228,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1252,7 +1252,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1264,7 +1264,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 58fecb8e5..564e970f3 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -429,7 +429,7 @@ def test_add_peering_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_add_peering_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_add_peering_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_add_peering_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -568,7 +568,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -580,7 +580,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -604,7 +604,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -616,7 +616,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -690,7 +690,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNetworkReques creation_timestamp="creation_timestamp_value", description="description_value", gateway_i_pv4="gateway_i_pv4_value", - id="id_value", + id=205, kind="kind_value", mtu=342, name="name_value", @@ -717,7 +717,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNetworkReques assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.gateway_i_pv4 == "gateway_i_pv4_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.mtu == 342 assert response.name == "name_value" @@ -896,7 +896,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -908,7 +908,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -932,7 +932,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -944,7 +944,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1289,7 +1289,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchNetworkRe error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1301,7 +1301,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchNetworkRe start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1325,7 +1325,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchNetworkRe assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1337,7 +1337,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchNetworkRe assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1424,7 +1424,7 @@ def test_remove_peering_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1436,7 +1436,7 @@ def test_remove_peering_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1460,7 +1460,7 @@ def test_remove_peering_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1472,7 +1472,7 @@ def test_remove_peering_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1563,7 +1563,7 @@ def test_switch_to_custom_mode_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1575,7 +1575,7 @@ def test_switch_to_custom_mode_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1599,7 +1599,7 @@ def test_switch_to_custom_mode_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1611,7 +1611,7 @@ def test_switch_to_custom_mode_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1689,7 +1689,7 @@ def test_update_peering_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1701,7 +1701,7 @@ def test_update_peering_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1725,7 +1725,7 @@ def test_update_peering_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1737,7 +1737,7 @@ def test_update_peering_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index 79aa2a051..cd142a262 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -433,7 +433,7 @@ def test_add_nodes_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -445,7 +445,7 @@ def test_add_nodes_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -469,7 +469,7 @@ def test_add_nodes_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -481,7 +481,7 @@ def test_add_nodes_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -738,7 +738,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -750,7 +750,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -774,7 +774,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -786,7 +786,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -866,7 +866,7 @@ def test_delete_nodes_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -878,7 +878,7 @@ def test_delete_nodes_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -902,7 +902,7 @@ def test_delete_nodes_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -914,7 +914,7 @@ def test_delete_nodes_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1003,7 +1003,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeGroupRequ creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", location_hint="location_hint_value", maintenance_policy=compute.NodeGroup.MaintenancePolicy.DEFAULT, @@ -1034,7 +1034,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeGroupRequ assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.location_hint == "location_hint_value" assert response.maintenance_policy == compute.NodeGroup.MaintenancePolicy.DEFAULT @@ -1224,7 +1224,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1236,7 +1236,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1260,7 +1260,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1272,7 +1272,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1644,7 +1644,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1656,7 +1656,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1680,7 +1680,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1692,7 +1692,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1904,7 +1904,7 @@ def test_set_node_template_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1916,7 +1916,7 @@ def test_set_node_template_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1940,7 +1940,7 @@ def test_set_node_template_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1952,7 +1952,7 @@ def test_set_node_template_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index d6865cc0a..45e5562c4 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -608,7 +608,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -620,7 +620,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -644,7 +644,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -656,7 +656,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -734,7 +734,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeTemplateR creation_timestamp="creation_timestamp_value", description="description_value", disks=[compute.LocalDisk(disk_count=1075)], - id="id_value", + id=205, kind="kind_value", name="name_value", node_affinity_labels={"key_value": "value_value"}, @@ -769,7 +769,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeTemplateR assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.disks == [compute.LocalDisk(disk_count=1075)] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.node_affinity_labels == {"key_value": "value_value"} @@ -963,7 +963,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -975,7 +975,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -999,7 +999,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1011,7 +1011,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index c377ffaa5..96e9277aa 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -580,7 +580,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeTypeReque deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", guest_cpus=1090, - id="id_value", + id=205, kind="kind_value", local_ssd_gb=1244, memory_mb=967, @@ -604,7 +604,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetNodeTypeReque assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" assert response.guest_cpus == 1090 - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.local_ssd_gb == 1244 assert response.memory_mb == 967 diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index a458bcb08..7e65223c3 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -623,7 +623,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -635,7 +635,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -659,7 +659,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -671,7 +671,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -753,7 +753,7 @@ def test_get_rest( description="description_value", enable=compute.PacketMirroring.Enable.FALSE, filter=compute.PacketMirroringFilter(I_p_protocols=["I_p_protocols_value"]), - id="id_value", + id=205, kind="kind_value", mirrored_resources=compute.PacketMirroringMirroredResourceInfo( instances=[ @@ -790,7 +790,7 @@ def test_get_rest( assert response.filter == compute.PacketMirroringFilter( I_p_protocols=["I_p_protocols_value"] ) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.mirrored_resources == compute.PacketMirroringMirroredResourceInfo( instances=[ @@ -881,7 +881,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -893,7 +893,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -917,7 +917,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -929,7 +929,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1172,7 +1172,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1184,7 +1184,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1208,7 +1208,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1220,7 +1220,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index 13684daa2..1d0aa1c8c 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -429,7 +429,7 @@ def test_disable_xpn_host_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_disable_xpn_host_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_disable_xpn_host_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_disable_xpn_host_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -550,7 +550,7 @@ def test_disable_xpn_resource_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -562,7 +562,7 @@ def test_disable_xpn_resource_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -586,7 +586,7 @@ def test_disable_xpn_resource_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -598,7 +598,7 @@ def test_disable_xpn_resource_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -686,7 +686,7 @@ def test_enable_xpn_host_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -698,7 +698,7 @@ def test_enable_xpn_host_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -722,7 +722,7 @@ def test_enable_xpn_host_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -734,7 +734,7 @@ def test_enable_xpn_host_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -807,7 +807,7 @@ def test_enable_xpn_resource_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -819,7 +819,7 @@ def test_enable_xpn_resource_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -843,7 +843,7 @@ def test_enable_xpn_resource_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -855,7 +855,7 @@ def test_enable_xpn_resource_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -940,7 +940,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetProjectReques default_service_account="default_service_account_value", description="description_value", enabled_features=["enabled_features_value"], - id="id_value", + id=205, kind="kind_value", name="name_value", quotas=[compute.Quota(limit=0.543)], @@ -969,7 +969,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetProjectReques assert response.default_service_account == "default_service_account_value" assert response.description == "description_value" assert response.enabled_features == ["enabled_features_value"] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.quotas == [compute.Quota(limit=0.543)] @@ -1043,7 +1043,7 @@ def test_get_xpn_host_rest( default_service_account="default_service_account_value", description="description_value", enabled_features=["enabled_features_value"], - id="id_value", + id=205, kind="kind_value", name="name_value", quotas=[compute.Quota(limit=0.543)], @@ -1072,7 +1072,7 @@ def test_get_xpn_host_rest( assert response.default_service_account == "default_service_account_value" assert response.description == "description_value" assert response.enabled_features == ["enabled_features_value"] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.quotas == [compute.Quota(limit=0.543)] @@ -1420,7 +1420,7 @@ def test_move_disk_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1432,7 +1432,7 @@ def test_move_disk_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1456,7 +1456,7 @@ def test_move_disk_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1468,7 +1468,7 @@ def test_move_disk_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1556,7 +1556,7 @@ def test_move_instance_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1568,7 +1568,7 @@ def test_move_instance_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1592,7 +1592,7 @@ def test_move_instance_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1604,7 +1604,7 @@ def test_move_instance_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1693,7 +1693,7 @@ def test_set_common_instance_metadata_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1705,7 +1705,7 @@ def test_set_common_instance_metadata_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1729,7 +1729,7 @@ def test_set_common_instance_metadata_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1741,7 +1741,7 @@ def test_set_common_instance_metadata_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1824,7 +1824,7 @@ def test_set_default_network_tier_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1836,7 +1836,7 @@ def test_set_default_network_tier_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1860,7 +1860,7 @@ def test_set_default_network_tier_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1872,7 +1872,7 @@ def test_set_default_network_tier_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1960,7 +1960,7 @@ def test_set_usage_export_bucket_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1972,7 +1972,7 @@ def test_set_usage_export_bucket_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1996,7 +1996,7 @@ def test_set_usage_export_bucket_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2008,7 +2008,7 @@ def test_set_usage_export_bucket_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index fc342fc19..c2f1e0f09 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -476,7 +476,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -488,7 +488,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -512,7 +512,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -524,7 +524,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -604,7 +604,7 @@ def test_get_rest( description="description_value", dns_verification_ip="dns_verification_ip_value", fingerprint="fingerprint_value", - id="id_value", + id=205, ip_cidr_range="ip_cidr_range_value", kind="kind_value", name="name_value", @@ -632,7 +632,7 @@ def test_get_rest( assert response.description == "description_value" assert response.dns_verification_ip == "dns_verification_ip_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_cidr_range == "ip_cidr_range_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -718,7 +718,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -730,7 +730,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -754,7 +754,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -766,7 +766,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1006,7 +1006,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1018,7 +1018,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1042,7 +1042,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1054,7 +1054,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index de406c21f..31e370cdc 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -653,7 +653,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -665,7 +665,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -689,7 +689,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -701,7 +701,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -783,7 +783,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, ip_cidr_range="ip_cidr_range_value", is_live_migration=True, kind="kind_value", @@ -812,7 +812,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_cidr_range == "ip_cidr_range_value" assert response.is_live_migration is True assert response.kind == "kind_value" @@ -905,7 +905,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -917,7 +917,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -941,7 +941,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -953,7 +953,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1199,7 +1199,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1211,7 +1211,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1235,7 +1235,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1247,7 +1247,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 06c821eb9..236c130e9 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -452,7 +452,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -578,7 +578,7 @@ def test_get_rest( autoscaling_policy=compute.AutoscalingPolicy(cool_down_period_sec=2112), creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", recommended_size=1693, @@ -610,7 +610,7 @@ def test_get_rest( ) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.recommended_size == 1693 @@ -702,7 +702,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -714,7 +714,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -738,7 +738,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -750,7 +750,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -987,7 +987,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -999,7 +999,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1023,7 +1023,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1035,7 +1035,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1126,7 +1126,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1138,7 +1138,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1162,7 +1162,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1174,7 +1174,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index da782230d..f21c6a2be 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -472,7 +472,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -484,7 +484,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -508,7 +508,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -520,7 +520,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -628,7 +628,7 @@ def test_get_rest( fingerprint="fingerprint_value", health_checks=["health_checks_value"], iap=compute.BackendServiceIAP(enabled=True), - id="id_value", + id=205, kind="kind_value", load_balancing_scheme=compute.BackendService.LoadBalancingScheme.EXTERNAL, locality_lb_policy=compute.BackendService.LocalityLbPolicy.INVALID_LB_POLICY, @@ -693,7 +693,7 @@ def test_get_rest( assert response.fingerprint == "fingerprint_value" assert response.health_checks == ["health_checks_value"] assert response.iap == compute.BackendServiceIAP(enabled=True) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert ( response.load_balancing_scheme @@ -906,7 +906,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -918,7 +918,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -942,7 +942,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -954,7 +954,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1189,7 +1189,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1201,7 +1201,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1225,7 +1225,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1237,7 +1237,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1333,7 +1333,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1345,7 +1345,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1369,7 +1369,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1381,7 +1381,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 3eca52860..6275a1ea8 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -613,9 +613,9 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", end_timestamp="end_timestamp_value", - id="id_value", + id=205, kind="kind_value", - license_resource=compute.LicenseResourceCommitment(amount="amount_value"), + license_resource=compute.LicenseResourceCommitment(amount=660), name="name_value", plan=compute.Commitment.Plan.INVALID, region="region_value", @@ -643,11 +643,9 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.end_timestamp == "end_timestamp_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" - assert response.license_resource == compute.LicenseResourceCommitment( - amount="amount_value" - ) + assert response.license_resource == compute.LicenseResourceCommitment(amount=660) assert response.name == "name_value" assert response.plan == compute.Commitment.Plan.INVALID assert response.region == "region_value" @@ -734,7 +732,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -746,7 +744,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -770,7 +768,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -782,7 +780,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index 9476ceecf..945947b72 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -445,10 +445,10 @@ def test_get_rest( # Designate an appropriate value for the returned response. return_value = compute.DiskType( creation_timestamp="creation_timestamp_value", - default_disk_size_gb="default_disk_size_gb_value", + default_disk_size_gb=2097, deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", region="region_value", @@ -468,10 +468,10 @@ def test_get_rest( # Establish that the response is the type that we expect. assert isinstance(response, compute.DiskType) assert response.creation_timestamp == "creation_timestamp_value" - assert response.default_disk_size_gb == "default_disk_size_gb_value" + assert response.default_disk_size_gb == 2097 assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.region == "region_value" diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index ab70e9a0a..d7fa6b861 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -433,7 +433,7 @@ def test_add_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -445,7 +445,7 @@ def test_add_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -469,7 +469,7 @@ def test_add_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -481,7 +481,7 @@ def test_add_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -575,7 +575,7 @@ def test_create_snapshot_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -587,7 +587,7 @@ def test_create_snapshot_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -611,7 +611,7 @@ def test_create_snapshot_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -623,7 +623,7 @@ def test_create_snapshot_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -713,7 +713,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -725,7 +725,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -749,7 +749,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -761,7 +761,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -842,25 +842,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionDiskReq type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ], - id="id_value", + id=205, kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, last_attach_timestamp="last_attach_timestamp_value", last_detach_timestamp="last_detach_timestamp_value", - license_codes=["license_codes_value"], + license_codes=[1360], licenses=["licenses_value"], location_hint="location_hint_value", name="name_value", options="options_value", - physical_block_size_bytes="physical_block_size_bytes_value", - provisioned_iops="provisioned_iops_value", + physical_block_size_bytes=2663, + provisioned_iops=1740, region="region_value", replica_zones=["replica_zones_value"], resource_policies=["resource_policies_value"], satisfies_pzs=True, self_link="self_link_value", - size_gb="size_gb_value", + size_gb=739, source_disk="source_disk_value", source_disk_id="source_disk_id_value", source_image="source_image_value", @@ -900,25 +900,25 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionDiskReq type_=compute.GuestOsFeature.Type.FEATURE_TYPE_UNSPECIFIED ) ] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} assert response.last_attach_timestamp == "last_attach_timestamp_value" assert response.last_detach_timestamp == "last_detach_timestamp_value" - assert response.license_codes == ["license_codes_value"] + assert response.license_codes == [1360] assert response.licenses == ["licenses_value"] assert response.location_hint == "location_hint_value" assert response.name == "name_value" assert response.options == "options_value" - assert response.physical_block_size_bytes == "physical_block_size_bytes_value" - assert response.provisioned_iops == "provisioned_iops_value" + assert response.physical_block_size_bytes == 2663 + assert response.provisioned_iops == 1740 assert response.region == "region_value" assert response.replica_zones == ["replica_zones_value"] assert response.resource_policies == ["resource_policies_value"] assert response.satisfies_pzs is True assert response.self_link == "self_link_value" - assert response.size_gb == "size_gb_value" + assert response.size_gb == 739 assert response.source_disk == "source_disk_value" assert response.source_disk_id == "source_disk_id_value" assert response.source_image == "source_image_value" @@ -1113,7 +1113,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1125,7 +1125,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1149,7 +1149,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1161,7 +1161,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1377,7 +1377,7 @@ def test_remove_resource_policies_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1389,7 +1389,7 @@ def test_remove_resource_policies_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1413,7 +1413,7 @@ def test_remove_resource_policies_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1425,7 +1425,7 @@ def test_remove_resource_policies_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1519,7 +1519,7 @@ def test_resize_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1531,7 +1531,7 @@ def test_resize_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1555,7 +1555,7 @@ def test_resize_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1567,7 +1567,7 @@ def test_resize_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1598,7 +1598,7 @@ def test_resize_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. region_disks_resize_request_resource = compute.RegionDisksResizeRequest( - size_gb="size_gb_value" + size_gb=739 ) client.resize( project="project_value", @@ -1634,7 +1634,7 @@ def test_resize_rest_flattened_error(): region="region_value", disk="disk_value", region_disks_resize_request_resource=compute.RegionDisksResizeRequest( - size_gb="size_gb_value" + size_gb=739 ), ) @@ -1779,7 +1779,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1791,7 +1791,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1815,7 +1815,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1827,7 +1827,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index a391b41e3..1ed0f9479 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -480,7 +480,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -492,7 +492,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -516,7 +516,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -528,7 +528,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -612,7 +612,7 @@ def test_get_rest( fingerprint="fingerprint_value", health_checks=["health_checks_value"], health_status_aggregation_policy=compute.HealthCheckService.HealthStatusAggregationPolicy.AND, - id="id_value", + id=205, kind="kind_value", name="name_value", network_endpoint_groups=["network_endpoint_groups_value"], @@ -639,7 +639,7 @@ def test_get_rest( response.health_status_aggregation_policy == compute.HealthCheckService.HealthStatusAggregationPolicy.AND ) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network_endpoint_groups == ["network_endpoint_groups_value"] @@ -725,7 +725,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -737,7 +737,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -761,7 +761,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -773,7 +773,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1016,7 +1016,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1028,7 +1028,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1052,7 +1052,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1064,7 +1064,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index d18984e74..509840794 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -454,7 +454,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -466,7 +466,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -490,7 +490,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -502,7 +502,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -591,7 +591,7 @@ def test_get_rest( http2_health_check=compute.HTTP2HealthCheck(host="host_value"), http_health_check=compute.HTTPHealthCheck(host="host_value"), https_health_check=compute.HTTPSHealthCheck(host="host_value"), - id="id_value", + id=205, kind="kind_value", log_config=compute.HealthCheckLogConfig(enable=True), name="name_value", @@ -624,7 +624,7 @@ def test_get_rest( assert response.http2_health_check == compute.HTTP2HealthCheck(host="host_value") assert response.http_health_check == compute.HTTPHealthCheck(host="host_value") assert response.https_health_check == compute.HTTPSHealthCheck(host="host_value") - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.log_config == compute.HealthCheckLogConfig(enable=True) assert response.name == "name_value" @@ -714,7 +714,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -726,7 +726,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -750,7 +750,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -762,7 +762,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -995,7 +995,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1007,7 +1007,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1031,7 +1031,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1043,7 +1043,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1137,7 +1137,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1149,7 +1149,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1173,7 +1173,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1185,7 +1185,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index 1ed41850d..5171ec0f0 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -481,7 +481,7 @@ def test_abandon_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -493,7 +493,7 @@ def test_abandon_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -517,7 +517,7 @@ def test_abandon_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -529,7 +529,7 @@ def test_abandon_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -628,7 +628,7 @@ def test_apply_updates_to_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -640,7 +640,7 @@ def test_apply_updates_to_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -664,7 +664,7 @@ def test_apply_updates_to_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -676,7 +676,7 @@ def test_apply_updates_to_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -775,7 +775,7 @@ def test_create_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -787,7 +787,7 @@ def test_create_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -811,7 +811,7 @@ def test_create_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -823,7 +823,7 @@ def test_create_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -922,7 +922,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -934,7 +934,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -958,7 +958,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -970,7 +970,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1057,7 +1057,7 @@ def test_delete_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1069,7 +1069,7 @@ def test_delete_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1093,7 +1093,7 @@ def test_delete_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1105,7 +1105,7 @@ def test_delete_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1204,7 +1204,7 @@ def test_delete_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1216,7 +1216,7 @@ def test_delete_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1240,7 +1240,7 @@ def test_delete_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1252,7 +1252,7 @@ def test_delete_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1356,7 +1356,7 @@ def test_get_rest( target_shape=compute.DistributionPolicy.TargetShape.ANY ), fingerprint="fingerprint_value", - id="id_value", + id=205, instance_group="instance_group_value", instance_template="instance_template_value", kind="kind_value", @@ -1410,7 +1410,7 @@ def test_get_rest( target_shape=compute.DistributionPolicy.TargetShape.ANY ) assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.instance_group == "instance_group_value" assert response.instance_template == "instance_template_value" assert response.kind == "kind_value" @@ -1519,7 +1519,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1531,7 +1531,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1555,7 +1555,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1567,7 +1567,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2304,7 +2304,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2316,7 +2316,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2340,7 +2340,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2352,7 +2352,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2459,7 +2459,7 @@ def test_patch_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2471,7 +2471,7 @@ def test_patch_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2495,7 +2495,7 @@ def test_patch_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2507,7 +2507,7 @@ def test_patch_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2610,7 +2610,7 @@ def test_recreate_instances_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2622,7 +2622,7 @@ def test_recreate_instances_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2646,7 +2646,7 @@ def test_recreate_instances_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2658,7 +2658,7 @@ def test_recreate_instances_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2757,7 +2757,7 @@ def test_resize_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2769,7 +2769,7 @@ def test_resize_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2793,7 +2793,7 @@ def test_resize_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2805,7 +2805,7 @@ def test_resize_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -2895,7 +2895,7 @@ def test_set_instance_template_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -2907,7 +2907,7 @@ def test_set_instance_template_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -2931,7 +2931,7 @@ def test_set_instance_template_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -2943,7 +2943,7 @@ def test_set_instance_template_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3042,7 +3042,7 @@ def test_set_target_pools_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3054,7 +3054,7 @@ def test_set_target_pools_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3078,7 +3078,7 @@ def test_set_target_pools_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3090,7 +3090,7 @@ def test_set_target_pools_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -3189,7 +3189,7 @@ def test_update_per_instance_configs_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -3201,7 +3201,7 @@ def test_update_per_instance_configs_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -3225,7 +3225,7 @@ def test_update_per_instance_configs_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -3237,7 +3237,7 @@ def test_update_per_instance_configs_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index f67c97fd0..096941fb9 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -468,7 +468,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", named_ports=[compute.NamedPort(name="name_value")], @@ -493,7 +493,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.named_ports == [compute.NamedPort(name="name_value")] @@ -897,7 +897,7 @@ def test_set_named_ports_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -909,7 +909,7 @@ def test_set_named_ports_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -933,7 +933,7 @@ def test_set_named_ports_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -945,7 +945,7 @@ def test_set_named_ports_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index f813127f5..e69b578ab 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -450,7 +450,7 @@ def test_bulk_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -462,7 +462,7 @@ def test_bulk_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -486,7 +486,7 @@ def test_bulk_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -498,7 +498,7 @@ def test_bulk_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -529,7 +529,7 @@ def test_bulk_insert_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. bulk_insert_instance_resource_resource = compute.BulkInsertInstanceResource( - count="count_value" + count=553 ) client.bulk_insert( project="project_value", @@ -562,7 +562,7 @@ def test_bulk_insert_rest_flattened_error(): project="project_value", region="region_value", bulk_insert_instance_resource_resource=compute.BulkInsertInstanceResource( - count="count_value" + count=553 ), ) diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index d63b2bf21..5945277a7 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -481,7 +481,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -493,7 +493,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -517,7 +517,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -529,7 +529,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -617,7 +617,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", default_port=1289, description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", network="network_value", @@ -652,7 +652,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.default_port == 1289 assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network == "network_value" @@ -745,7 +745,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -757,7 +757,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -781,7 +781,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -793,7 +793,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 16b47c5ed..1084c8f1f 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -481,7 +481,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -493,7 +493,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -517,7 +517,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -529,7 +529,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -613,7 +613,7 @@ def test_get_rest( grpc_settings=compute.NotificationEndpointGrpcSettings( authority="authority_value" ), - id="id_value", + id=205, kind="kind_value", name="name_value", region="region_value", @@ -635,7 +635,7 @@ def test_get_rest( assert response.grpc_settings == compute.NotificationEndpointGrpcSettings( authority="authority_value" ) - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.region == "region_value" @@ -720,7 +720,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -732,7 +732,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -756,7 +756,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -768,7 +768,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index 9bb9dd904..bc6076e5a 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -529,7 +529,7 @@ def test_get_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -541,7 +541,7 @@ def test_get_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -565,7 +565,7 @@ def test_get_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -577,7 +577,7 @@ def test_get_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -787,7 +787,7 @@ def test_wait_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -799,7 +799,7 @@ def test_wait_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -823,7 +823,7 @@ def test_wait_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -835,7 +835,7 @@ def test_wait_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index 5ec4569e8..f056c569d 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -472,7 +472,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -484,7 +484,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -508,7 +508,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -520,7 +520,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -603,7 +603,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", expire_time="expire_time_value", - id="id_value", + id=205, kind="kind_value", managed=compute.SslCertificateManagedSslCertificate( domain_status={"key_value": "value_value"} @@ -633,7 +633,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.expire_time == "expire_time_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.managed == compute.SslCertificateManagedSslCertificate( domain_status={"key_value": "value_value"} @@ -726,7 +726,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -738,7 +738,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -762,7 +762,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -774,7 +774,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index e8fadaa1b..f6e2a038e 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -472,7 +472,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -484,7 +484,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -508,7 +508,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -520,7 +520,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -602,7 +602,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_bind=True, @@ -624,7 +624,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_bind is True @@ -710,7 +710,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -722,7 +722,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -746,7 +746,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -758,7 +758,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -999,7 +999,7 @@ def test_set_url_map_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1011,7 +1011,7 @@ def test_set_url_map_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1035,7 +1035,7 @@ def test_set_url_map_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1047,7 +1047,7 @@ def test_set_url_map_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index 3ade3d966..2db040d9b 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -478,7 +478,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -490,7 +490,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -514,7 +514,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -526,7 +526,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -609,7 +609,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_bind=True, @@ -636,7 +636,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_bind is True @@ -726,7 +726,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -738,7 +738,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -762,7 +762,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -774,7 +774,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1018,7 +1018,7 @@ def test_set_ssl_certificates_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1030,7 +1030,7 @@ def test_set_ssl_certificates_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1054,7 +1054,7 @@ def test_set_ssl_certificates_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1066,7 +1066,7 @@ def test_set_ssl_certificates_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1164,7 +1164,7 @@ def test_set_url_map_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1176,7 +1176,7 @@ def test_set_url_map_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1200,7 +1200,7 @@ def test_set_url_map_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1212,7 +1212,7 @@ def test_set_url_map_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index 581f23197..c9e9e3472 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -440,7 +440,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -452,7 +452,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -476,7 +476,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -488,7 +488,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -575,7 +575,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionUrlMapR ] ), host_rules=[compute.HostRule(description="description_value")], - id="id_value", + id=205, kind="kind_value", name="name_value", path_matchers=[ @@ -616,7 +616,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionUrlMapR ] ) assert response.host_rules == [compute.HostRule(description="description_value")] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.path_matchers == [ @@ -702,7 +702,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -714,7 +714,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -738,7 +738,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -750,7 +750,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -969,7 +969,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -981,7 +981,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1005,7 +1005,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1017,7 +1017,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1109,7 +1109,7 @@ def test_update_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1121,7 +1121,7 @@ def test_update_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1145,7 +1145,7 @@ def test_update_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1157,7 +1157,7 @@ def test_update_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index 7996022c2..a8fa3798e 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -422,7 +422,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionRequest creation_timestamp="creation_timestamp_value", deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", quotas=[compute.Quota(limit=0.543)], @@ -445,7 +445,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRegionRequest assert response.creation_timestamp == "creation_timestamp_value" assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.quotas == [compute.Quota(limit=0.543)] diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index 792889e6a..0f1efffb2 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -589,7 +589,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -601,7 +601,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -625,7 +625,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -637,7 +637,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -711,14 +711,12 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetReservationRe commitment="commitment_value", creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", satisfies_pzs=True, self_link="self_link_value", - specific_reservation=compute.AllocationSpecificSKUReservation( - count="count_value" - ), + specific_reservation=compute.AllocationSpecificSKUReservation(count=553), specific_reservation_required=True, status=compute.Reservation.Status.CREATING, zone="zone_value", @@ -737,13 +735,13 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetReservationRe assert response.commitment == "commitment_value" assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.satisfies_pzs is True assert response.self_link == "self_link_value" assert response.specific_reservation == compute.AllocationSpecificSKUReservation( - count="count_value" + count=553 ) assert response.specific_reservation_required is True assert response.status == compute.Reservation.Status.CREATING @@ -925,7 +923,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -937,7 +935,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -961,7 +959,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -973,7 +971,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1196,7 +1194,7 @@ def test_resize_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1208,7 +1206,7 @@ def test_resize_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1232,7 +1230,7 @@ def test_resize_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1244,7 +1242,7 @@ def test_resize_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1275,7 +1273,7 @@ def test_resize_rest_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. reservations_resize_request_resource = compute.ReservationsResizeRequest( - specific_sku_count="specific_sku_count_value" + specific_sku_count=1920 ) client.resize( project="project_value", @@ -1311,7 +1309,7 @@ def test_resize_rest_flattened_error(): zone="zone_value", reservation="reservation_value", reservations_resize_request_resource=compute.ReservationsResizeRequest( - specific_sku_count="specific_sku_count_value" + specific_sku_count=1920 ), ) diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index 4d9589b52..e109cc304 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -619,7 +619,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -631,7 +631,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -655,7 +655,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -667,7 +667,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -747,7 +747,7 @@ def test_get_rest( group_placement_policy=compute.ResourcePolicyGroupPlacementPolicy( availability_domain_count=2650 ), - id="id_value", + id=205, instance_schedule_policy=compute.ResourcePolicyInstanceSchedulePolicy( expiration_time="expiration_time_value" ), @@ -784,7 +784,7 @@ def test_get_rest( response.group_placement_policy == compute.ResourcePolicyGroupPlacementPolicy(availability_domain_count=2650) ) - assert response.id == "id_value" + assert response.id == 205 assert ( response.instance_schedule_policy == compute.ResourcePolicyInstanceSchedulePolicy( @@ -988,7 +988,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1000,7 +1000,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1024,7 +1024,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1036,7 +1036,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index 34a0632f9..18bb16851 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -591,7 +591,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouterR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -603,7 +603,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouterR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -627,7 +627,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouterR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -639,7 +639,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouterR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -721,7 +721,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRouterRequest creation_timestamp="creation_timestamp_value", description="description_value", encrypted_interconnect_router=True, - id="id_value", + id=205, interfaces=[compute.RouterInterface(ip_range="ip_range_value")], kind="kind_value", name="name_value", @@ -750,7 +750,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRouterRequest assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.encrypted_interconnect_router is True - assert response.id == "id_value" + assert response.id == 205 assert response.interfaces == [compute.RouterInterface(ip_range="ip_range_value")] assert response.kind == "kind_value" assert response.name == "name_value" @@ -1060,7 +1060,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouterR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1072,7 +1072,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouterR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1096,7 +1096,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouterR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1108,7 +1108,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouterR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1335,7 +1335,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchRouterReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1347,7 +1347,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchRouterReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1371,7 +1371,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchRouterReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1383,7 +1383,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchRouterReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1579,7 +1579,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateRouterR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1591,7 +1591,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateRouterR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1615,7 +1615,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateRouterR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1627,7 +1627,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateRouterR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 5f01fd4a6..5d524e6b6 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -424,7 +424,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouteRe error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -436,7 +436,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouteRe start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -460,7 +460,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouteRe assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -472,7 +472,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteRouteRe assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -542,7 +542,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRouteRequest) creation_timestamp="creation_timestamp_value", description="description_value", dest_range="dest_range_value", - id="id_value", + id=205, kind="kind_value", name="name_value", network="network_value", @@ -572,7 +572,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetRouteRequest) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.dest_range == "dest_range_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network == "network_value" @@ -656,7 +656,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouteRe error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -668,7 +668,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouteRe start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -692,7 +692,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouteRe assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -704,7 +704,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertRouteRe assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index aaecb5faa..b8f83b49d 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -452,7 +452,7 @@ def test_add_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_add_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_add_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_add_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -591,7 +591,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -603,7 +603,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -627,7 +627,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -639,7 +639,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -713,7 +713,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", rules=[compute.SecurityPolicyRule(action="action_value")], @@ -733,7 +733,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.rules == [compute.SecurityPolicyRule(action="action_value")] @@ -905,7 +905,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -917,7 +917,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -941,7 +941,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -953,7 +953,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1264,7 +1264,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1276,7 +1276,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1300,7 +1300,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1312,7 +1312,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1403,7 +1403,7 @@ def test_patch_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1415,7 +1415,7 @@ def test_patch_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1439,7 +1439,7 @@ def test_patch_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1451,7 +1451,7 @@ def test_patch_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1542,7 +1542,7 @@ def test_remove_rule_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1554,7 +1554,7 @@ def test_remove_rule_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1578,7 +1578,7 @@ def test_remove_rule_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1590,7 +1590,7 @@ def test_remove_rule_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index 91eb4289d..0150518d9 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -429,7 +429,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -441,7 +441,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -465,7 +465,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -477,7 +477,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -550,13 +550,13 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSnapshotReque chain_name="chain_name_value", creation_timestamp="creation_timestamp_value", description="description_value", - disk_size_gb="disk_size_gb_value", - download_bytes="download_bytes_value", - id="id_value", + disk_size_gb=1261, + download_bytes=1502, + id=205, kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, - license_codes=["license_codes_value"], + license_codes=[1360], licenses=["licenses_value"], location_hint="location_hint_value", name="name_value", @@ -571,7 +571,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSnapshotReque ), source_disk_id="source_disk_id_value", status=compute.Snapshot.Status.CREATING, - storage_bytes="storage_bytes_value", + storage_bytes=1403, storage_bytes_status=compute.Snapshot.StorageBytesStatus.UPDATING, storage_locations=["storage_locations_value"], ) @@ -590,13 +590,13 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSnapshotReque assert response.chain_name == "chain_name_value" assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.disk_size_gb == "disk_size_gb_value" - assert response.download_bytes == "download_bytes_value" - assert response.id == "id_value" + assert response.disk_size_gb == 1261 + assert response.download_bytes == 1502 + assert response.id == 205 assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} - assert response.license_codes == ["license_codes_value"] + assert response.license_codes == [1360] assert response.licenses == ["licenses_value"] assert response.location_hint == "location_hint_value" assert response.name == "name_value" @@ -611,7 +611,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSnapshotReque ) assert response.source_disk_id == "source_disk_id_value" assert response.status == compute.Snapshot.Status.CREATING - assert response.storage_bytes == "storage_bytes_value" + assert response.storage_bytes == 1403 assert response.storage_bytes_status == compute.Snapshot.StorageBytesStatus.UPDATING assert response.storage_locations == ["storage_locations_value"] @@ -1023,7 +1023,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1035,7 +1035,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1059,7 +1059,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1071,7 +1071,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index 987f7e153..ce055b283 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -612,7 +612,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -624,7 +624,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -648,7 +648,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -660,7 +660,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -735,7 +735,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", expire_time="expire_time_value", - id="id_value", + id=205, kind="kind_value", managed=compute.SslCertificateManagedSslCertificate( domain_status={"key_value": "value_value"} @@ -765,7 +765,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.expire_time == "expire_time_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.managed == compute.SslCertificateManagedSslCertificate( domain_status={"key_value": "value_value"} @@ -850,7 +850,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -862,7 +862,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -886,7 +886,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -898,7 +898,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index cd2c0a8fb..7be318868 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -433,7 +433,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -445,7 +445,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -469,7 +469,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -481,7 +481,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -555,7 +555,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSslPolicyRequ description="description_value", enabled_features=["enabled_features_value"], fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", min_tls_version=compute.SslPolicy.MinTlsVersion.TLS_1_0, name="name_value", @@ -579,7 +579,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSslPolicyRequ assert response.description == "description_value" assert response.enabled_features == ["enabled_features_value"] assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.min_tls_version == compute.SslPolicy.MinTlsVersion.TLS_1_0 assert response.name == "name_value" @@ -659,7 +659,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -671,7 +671,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -695,7 +695,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -707,7 +707,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -999,7 +999,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1011,7 +1011,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1035,7 +1035,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1047,7 +1047,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index aca91cef4..f77bb3b65 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -595,7 +595,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -607,7 +607,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -631,7 +631,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -643,7 +643,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -725,7 +725,7 @@ def test_expand_ip_cidr_range_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -737,7 +737,7 @@ def test_expand_ip_cidr_range_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -761,7 +761,7 @@ def test_expand_ip_cidr_range_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -773,7 +773,7 @@ def test_expand_ip_cidr_range_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -863,7 +863,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSubnetworkReq enable_flow_logs=True, fingerprint="fingerprint_value", gateway_address="gateway_address_value", - id="id_value", + id=205, ip_cidr_range="ip_cidr_range_value", ipv6_cidr_range="ipv6_cidr_range_value", kind="kind_value", @@ -899,7 +899,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetSubnetworkReq assert response.enable_flow_logs is True assert response.fingerprint == "fingerprint_value" assert response.gateway_address == "gateway_address_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ip_cidr_range == "ip_cidr_range_value" assert response.ipv6_cidr_range == "ipv6_cidr_range_value" assert response.kind == "kind_value" @@ -1100,7 +1100,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1112,7 +1112,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1136,7 +1136,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1148,7 +1148,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1516,7 +1516,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1528,7 +1528,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1552,7 +1552,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1564,7 +1564,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1777,7 +1777,7 @@ def test_set_private_ip_google_access_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1789,7 +1789,7 @@ def test_set_private_ip_google_access_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1813,7 +1813,7 @@ def test_set_private_ip_google_access_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1825,7 +1825,7 @@ def test_set_private_ip_google_access_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index 62ce6b3b1..5c53e4eb7 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -452,7 +452,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -574,7 +574,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", self_link="self_link_value", @@ -596,7 +596,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.self_link == "self_link_value" @@ -674,7 +674,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -686,7 +686,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -710,7 +710,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -722,7 +722,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -945,7 +945,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -957,7 +957,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -981,7 +981,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -993,7 +993,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index be55791c4..3820fa3c9 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -615,7 +615,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -627,7 +627,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -651,7 +651,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -663,7 +663,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -737,7 +737,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_bind=True, @@ -759,7 +759,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_bind is True @@ -837,7 +837,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -849,7 +849,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -873,7 +873,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -885,7 +885,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1108,7 +1108,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1120,7 +1120,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1144,7 +1144,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1156,7 +1156,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1247,7 +1247,7 @@ def test_set_url_map_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1259,7 +1259,7 @@ def test_set_url_map_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1283,7 +1283,7 @@ def test_set_url_map_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1295,7 +1295,7 @@ def test_set_url_map_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index db5c24865..72234c2c8 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -628,7 +628,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -640,7 +640,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -664,7 +664,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -676,7 +676,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -755,7 +755,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", fingerprint="fingerprint_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_bind=True, @@ -782,7 +782,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.fingerprint == "fingerprint_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_bind is True @@ -868,7 +868,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -880,7 +880,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -904,7 +904,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -916,7 +916,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1151,7 +1151,7 @@ def test_patch_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1163,7 +1163,7 @@ def test_patch_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1187,7 +1187,7 @@ def test_patch_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1199,7 +1199,7 @@ def test_patch_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1294,7 +1294,7 @@ def test_set_quic_override_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1306,7 +1306,7 @@ def test_set_quic_override_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1330,7 +1330,7 @@ def test_set_quic_override_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1342,7 +1342,7 @@ def test_set_quic_override_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1438,7 +1438,7 @@ def test_set_ssl_certificates_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1450,7 +1450,7 @@ def test_set_ssl_certificates_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1474,7 +1474,7 @@ def test_set_ssl_certificates_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1486,7 +1486,7 @@ def test_set_ssl_certificates_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1581,7 +1581,7 @@ def test_set_ssl_policy_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1593,7 +1593,7 @@ def test_set_ssl_policy_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1617,7 +1617,7 @@ def test_set_ssl_policy_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1629,7 +1629,7 @@ def test_set_ssl_policy_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1724,7 +1724,7 @@ def test_set_url_map_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1736,7 +1736,7 @@ def test_set_url_map_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1760,7 +1760,7 @@ def test_set_url_map_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1772,7 +1772,7 @@ def test_set_url_map_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index 8ff737298..86dc7540f 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -616,7 +616,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -628,7 +628,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -652,7 +652,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -664,7 +664,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -741,7 +741,7 @@ def test_get_rest( return_value = compute.TargetInstance( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, instance="instance_value", kind="kind_value", name="name_value", @@ -762,7 +762,7 @@ def test_get_rest( assert isinstance(response, compute.TargetInstance) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.instance == "instance_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -844,7 +844,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -856,7 +856,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -880,7 +880,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -892,7 +892,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index 4519bd968..5c179dccf 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -433,7 +433,7 @@ def test_add_health_check_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -445,7 +445,7 @@ def test_add_health_check_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -469,7 +469,7 @@ def test_add_health_check_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -481,7 +481,7 @@ def test_add_health_check_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -579,7 +579,7 @@ def test_add_instance_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -591,7 +591,7 @@ def test_add_instance_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -615,7 +615,7 @@ def test_add_instance_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -627,7 +627,7 @@ def test_add_instance_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -877,7 +877,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -889,7 +889,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -913,7 +913,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -925,7 +925,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1003,7 +1003,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetTargetPoolReq description="description_value", failover_ratio=0.1494, health_checks=["health_checks_value"], - id="id_value", + id=205, instances=["instances_value"], kind="kind_value", name="name_value", @@ -1027,7 +1027,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetTargetPoolReq assert response.description == "description_value" assert math.isclose(response.failover_ratio, 0.1494, rel_tol=1e-6) assert response.health_checks == ["health_checks_value"] - assert response.id == "id_value" + assert response.id == 205 assert response.instances == ["instances_value"] assert response.kind == "kind_value" assert response.name == "name_value" @@ -1209,7 +1209,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1221,7 +1221,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1245,7 +1245,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1257,7 +1257,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1480,7 +1480,7 @@ def test_remove_health_check_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1492,7 +1492,7 @@ def test_remove_health_check_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1516,7 +1516,7 @@ def test_remove_health_check_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1528,7 +1528,7 @@ def test_remove_health_check_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1626,7 +1626,7 @@ def test_remove_instance_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1638,7 +1638,7 @@ def test_remove_instance_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1662,7 +1662,7 @@ def test_remove_instance_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1674,7 +1674,7 @@ def test_remove_instance_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1768,7 +1768,7 @@ def test_set_backup_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1780,7 +1780,7 @@ def test_set_backup_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1804,7 +1804,7 @@ def test_set_backup_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1816,7 +1816,7 @@ def test_set_backup_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index b3db01509..53af0816d 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -452,7 +452,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -573,7 +573,7 @@ def test_get_rest( return_value = compute.TargetSslProxy( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_header=compute.TargetSslProxy.ProxyHeader.NONE, @@ -595,7 +595,7 @@ def test_get_rest( assert isinstance(response, compute.TargetSslProxy) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_header == compute.TargetSslProxy.ProxyHeader.NONE @@ -674,7 +674,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -686,7 +686,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -710,7 +710,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -722,7 +722,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -945,7 +945,7 @@ def test_set_backend_service_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -957,7 +957,7 @@ def test_set_backend_service_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -981,7 +981,7 @@ def test_set_backend_service_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -993,7 +993,7 @@ def test_set_backend_service_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1084,7 +1084,7 @@ def test_set_proxy_header_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1096,7 +1096,7 @@ def test_set_proxy_header_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1120,7 +1120,7 @@ def test_set_proxy_header_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1132,7 +1132,7 @@ def test_set_proxy_header_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1224,7 +1224,7 @@ def test_set_ssl_certificates_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1236,7 +1236,7 @@ def test_set_ssl_certificates_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1260,7 +1260,7 @@ def test_set_ssl_certificates_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1272,7 +1272,7 @@ def test_set_ssl_certificates_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1363,7 +1363,7 @@ def test_set_ssl_policy_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1375,7 +1375,7 @@ def test_set_ssl_policy_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1399,7 +1399,7 @@ def test_set_ssl_policy_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1411,7 +1411,7 @@ def test_set_ssl_policy_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index 5507c263f..cb35e7ff5 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -452,7 +452,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -464,7 +464,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -488,7 +488,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -500,7 +500,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -573,7 +573,7 @@ def test_get_rest( return_value = compute.TargetTcpProxy( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", proxy_bind=True, @@ -594,7 +594,7 @@ def test_get_rest( assert isinstance(response, compute.TargetTcpProxy) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.proxy_bind is True @@ -672,7 +672,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -684,7 +684,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -708,7 +708,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -720,7 +720,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -943,7 +943,7 @@ def test_set_backend_service_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -955,7 +955,7 @@ def test_set_backend_service_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -979,7 +979,7 @@ def test_set_backend_service_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -991,7 +991,7 @@ def test_set_backend_service_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1082,7 +1082,7 @@ def test_set_proxy_header_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1094,7 +1094,7 @@ def test_set_proxy_header_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1118,7 +1118,7 @@ def test_set_proxy_header_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1130,7 +1130,7 @@ def test_set_proxy_header_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index 7126af9ea..fd2561d55 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -617,7 +617,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -629,7 +629,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -653,7 +653,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -665,7 +665,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -743,7 +743,7 @@ def test_get_rest( creation_timestamp="creation_timestamp_value", description="description_value", forwarding_rules=["forwarding_rules_value"], - id="id_value", + id=205, kind="kind_value", name="name_value", network="network_value", @@ -766,7 +766,7 @@ def test_get_rest( assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.forwarding_rules == ["forwarding_rules_value"] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.network == "network_value" @@ -849,7 +849,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -861,7 +861,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -885,7 +885,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -897,7 +897,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index a9c8e2ab8..570620b6c 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -581,7 +581,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteUrlMapR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -593,7 +593,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteUrlMapR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -617,7 +617,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteUrlMapR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -629,7 +629,7 @@ def test_delete_rest(transport: str = "rest", request_type=compute.DeleteUrlMapR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -714,7 +714,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetUrlMapRequest ] ), host_rules=[compute.HostRule(description="description_value")], - id="id_value", + id=205, kind="kind_value", name="name_value", path_matchers=[ @@ -755,7 +755,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetUrlMapRequest ] ) assert response.host_rules == [compute.HostRule(description="description_value")] - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.path_matchers == [ @@ -837,7 +837,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertUrlMapR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -849,7 +849,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertUrlMapR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -873,7 +873,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertUrlMapR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -885,7 +885,7 @@ def test_insert_rest(transport: str = "rest", request_type=compute.InsertUrlMapR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -970,7 +970,7 @@ def test_invalidate_cache_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -982,7 +982,7 @@ def test_invalidate_cache_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1006,7 +1006,7 @@ def test_invalidate_cache_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1018,7 +1018,7 @@ def test_invalidate_cache_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1230,7 +1230,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchUrlMapReq error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1242,7 +1242,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchUrlMapReq start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1266,7 +1266,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchUrlMapReq assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1278,7 +1278,7 @@ def test_patch_rest(transport: str = "rest", request_type=compute.PatchUrlMapReq assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1365,7 +1365,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateUrlMapR error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1377,7 +1377,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateUrlMapR start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1401,7 +1401,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateUrlMapR assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1413,7 +1413,7 @@ def test_update_rest(transport: str = "rest", request_type=compute.UpdateUrlMapR assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index d3fc29192..2b4e33fe8 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -595,7 +595,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -607,7 +607,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -631,7 +631,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -643,7 +643,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -718,7 +718,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetVpnGatewayReq return_value = compute.VpnGateway( creation_timestamp="creation_timestamp_value", description="description_value", - id="id_value", + id=205, kind="kind_value", label_fingerprint="label_fingerprint_value", labels={"key_value": "value_value"}, @@ -741,7 +741,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetVpnGatewayReq assert isinstance(response, compute.VpnGateway) assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.label_fingerprint == "label_fingerprint_value" assert response.labels == {"key_value": "value_value"} @@ -919,7 +919,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -931,7 +931,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -955,7 +955,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -967,7 +967,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -1196,7 +1196,7 @@ def test_set_labels_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -1208,7 +1208,7 @@ def test_set_labels_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -1232,7 +1232,7 @@ def test_set_labels_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -1244,7 +1244,7 @@ def test_set_labels_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index 174577803..cb4e138d6 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -590,7 +590,7 @@ def test_delete_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -602,7 +602,7 @@ def test_delete_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -626,7 +626,7 @@ def test_delete_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -638,7 +638,7 @@ def test_delete_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -714,7 +714,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetVpnTunnelRequ creation_timestamp="creation_timestamp_value", description="description_value", detailed_status="detailed_status_value", - id="id_value", + id=205, ike_version=1182, kind="kind_value", local_traffic_selector=["local_traffic_selector_value"], @@ -748,7 +748,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetVpnTunnelRequ assert response.creation_timestamp == "creation_timestamp_value" assert response.description == "description_value" assert response.detailed_status == "detailed_status_value" - assert response.id == "id_value" + assert response.id == 205 assert response.ike_version == 1182 assert response.kind == "kind_value" assert response.local_traffic_selector == ["local_traffic_selector_value"] @@ -842,7 +842,7 @@ def test_insert_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -854,7 +854,7 @@ def test_insert_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -878,7 +878,7 @@ def test_insert_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -890,7 +890,7 @@ def test_insert_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index af6ac4528..17f884331 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -518,7 +518,7 @@ def test_get_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -530,7 +530,7 @@ def test_get_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -554,7 +554,7 @@ def test_get_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -566,7 +566,7 @@ def test_get_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ @@ -776,7 +776,7 @@ def test_wait_rest( error=compute.Error(errors=[compute.Errors(code="code_value")]), http_error_message="http_error_message_value", http_error_status_code=2374, - id="id_value", + id=205, insert_time="insert_time_value", kind="kind_value", name="name_value", @@ -788,7 +788,7 @@ def test_wait_rest( start_time="start_time_value", status=compute.Operation.Status.DONE, status_message="status_message_value", - target_id="target_id_value", + target_id=947, target_link="target_link_value", user="user_value", warnings=[compute.Warnings(code=compute.Warnings.Code.CLEANUP_FAILED)], @@ -812,7 +812,7 @@ def test_wait_rest( assert response.error == compute.Error(errors=[compute.Errors(code="code_value")]) assert response.http_error_message == "http_error_message_value" assert response.http_error_status_code == 2374 - assert response.id == "id_value" + assert response.id == 205 assert response.insert_time == "insert_time_value" assert response.kind == "kind_value" assert response.name == "name_value" @@ -824,7 +824,7 @@ def test_wait_rest( assert response.start_time == "start_time_value" assert response.status == compute.Operation.Status.DONE assert response.status_message == "status_message_value" - assert response.target_id == "target_id_value" + assert response.target_id == 947 assert response.target_link == "target_link_value" assert response.user == "user_value" assert response.warnings == [ diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 06b5c182a..490e44f60 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -421,7 +421,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetZoneRequest): creation_timestamp="creation_timestamp_value", deprecated=compute.DeprecationStatus(deleted="deleted_value"), description="description_value", - id="id_value", + id=205, kind="kind_value", name="name_value", region="region_value", @@ -444,7 +444,7 @@ def test_get_rest(transport: str = "rest", request_type=compute.GetZoneRequest): assert response.creation_timestamp == "creation_timestamp_value" assert response.deprecated == compute.DeprecationStatus(deleted="deleted_value") assert response.description == "description_value" - assert response.id == "id_value" + assert response.id == 205 assert response.kind == "kind_value" assert response.name == "name_value" assert response.region == "region_value" From 757f4ce4801e8749a1e48e571586455382981bc3 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 5 Aug 2021 23:16:08 +0000 Subject: [PATCH 4/5] chore: update gapic-generator-python to 0.50.5 https://github.com/googleapis/gapic-generator-python/blob/master/CHANGELOG.md#0505-2021-07-22 Needed to fix failing generated unit tests in https://github.com/googleapis/python-compute/pull/91 Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Thu Aug 5 16:21:09 2021 -0600 Source-Repo: googleapis/googleapis-discovery Source-Sha: ac663f7f0afb13e3a8cfd04160d1677655c5c613 Source-Link: https://github.com/googleapis/googleapis-discovery/commit/ac663f7f0afb13e3a8cfd04160d1677655c5c613 --- .../accelerator_types/transports/rest.py | 30 +- .../services/addresses/transports/rest.py | 48 +- .../services/autoscalers/transports/rest.py | 68 +-- .../backend_buckets/transports/rest.py | 81 +--- .../backend_services/transports/rest.py | 109 ++--- .../services/disk_types/transports/rest.py | 30 +- .../services/disks/transports/rest.py | 126 ++---- .../external_vpn_gateways/transports/rest.py | 60 +-- .../firewall_policies/transports/rest.py | 164 ++----- .../services/firewalls/transports/rest.py | 60 +-- .../forwarding_rules/transports/rest.py | 78 +--- .../global_addresses/transports/rest.py | 40 +- .../transports/rest.py | 70 +-- .../transports/rest.py | 68 +-- .../global_operations/transports/rest.py | 46 +- .../transports/rest.py | 30 +- .../transports/rest.py | 50 +-- .../services/health_checks/transports/rest.py | 68 +-- .../services/images/transports/rest.py | 106 ++--- .../transports/rest.py | 193 +++----- .../instance_groups/transports/rest.py | 88 +--- .../instance_templates/transports/rest.py | 68 +-- .../services/instances/transports/rest.py | 415 +++++------------- .../transports/rest.py | 58 +-- .../interconnect_locations/transports/rest.py | 22 +- .../services/interconnects/transports/rest.py | 58 +-- .../services/license_codes/transports/rest.py | 24 +- .../services/licenses/transports/rest.py | 74 +--- .../services/machine_types/transports/rest.py | 30 +- .../transports/rest.py | 88 +--- .../services/networks/transports/rest.py | 104 ++--- .../services/node_groups/transports/rest.py | 127 ++---- .../node_templates/transports/rest.py | 76 +--- .../services/node_types/transports/rest.py | 30 +- .../packet_mirrorings/transports/rest.py | 68 +-- .../services/projects/transports/rest.py | 126 ++---- .../transports/rest.py | 50 +-- .../transports/rest.py | 58 +-- .../region_autoscalers/transports/rest.py | 60 +-- .../transports/rest.py | 70 +-- .../region_commitments/transports/rest.py | 40 +- .../region_disk_types/transports/rest.py | 22 +- .../services/region_disks/transports/rest.py | 118 ++--- .../transports/rest.py | 50 +-- .../region_health_checks/transports/rest.py | 60 +-- .../transports/rest.py | 185 +++----- .../region_instance_groups/transports/rest.py | 42 +- .../region_instances/transports/rest.py | 16 +- .../transports/rest.py | 40 +- .../transports/rest.py | 40 +- .../region_operations/transports/rest.py | 38 +- .../transports/rest.py | 40 +- .../transports/rest.py | 50 +-- .../transports/rest.py | 60 +-- .../region_url_maps/transports/rest.py | 70 +-- .../services/regions/transports/rest.py | 22 +- .../services/reservations/transports/rest.py | 86 +--- .../resource_policies/transports/rest.py | 76 +--- .../services/routers/transports/rest.py | 94 +--- .../services/routes/transports/rest.py | 40 +- .../security_policies/transports/rest.py | 94 +--- .../services/snapshots/transports/rest.py | 68 +-- .../ssl_certificates/transports/rest.py | 48 +- .../services/ssl_policies/transports/rest.py | 58 +-- .../services/subnetworks/transports/rest.py | 114 ++--- .../target_grpc_proxies/transports/rest.py | 50 +-- .../target_http_proxies/transports/rest.py | 68 +-- .../target_https_proxies/transports/rest.py | 98 ++--- .../target_instances/transports/rest.py | 48 +- .../services/target_pools/transports/rest.py | 108 ++--- .../target_ssl_proxies/transports/rest.py | 80 +--- .../target_tcp_proxies/transports/rest.py | 60 +-- .../target_vpn_gateways/transports/rest.py | 48 +- .../services/url_maps/transports/rest.py | 88 +--- .../services/vpn_gateways/transports/rest.py | 76 +--- .../services/vpn_tunnels/transports/rest.py | 48 +- .../zone_operations/transports/rest.py | 38 +- .../services/zones/transports/rest.py | 22 +- synth.metadata | 2 +- .../compute_v1/test_accelerator_types.py | 34 +- tests/unit/gapic/compute_v1/test_addresses.py | 48 +- .../unit/gapic/compute_v1/test_autoscalers.py | 62 +-- .../gapic/compute_v1/test_backend_buckets.py | 65 +-- .../gapic/compute_v1/test_backend_services.py | 82 ++-- .../unit/gapic/compute_v1/test_disk_types.py | 34 +- tests/unit/gapic/compute_v1/test_disks.py | 120 ++--- .../compute_v1/test_external_vpn_gateways.py | 51 ++- .../compute_v1/test_firewall_policies.py | 81 ++-- tests/unit/gapic/compute_v1/test_firewalls.py | 51 ++- .../gapic/compute_v1/test_forwarding_rules.py | 75 ++-- .../gapic/compute_v1/test_global_addresses.py | 37 +- .../test_global_forwarding_rules.py | 58 +-- .../test_global_network_endpoint_groups.py | 58 +-- .../compute_v1/test_global_operations.py | 40 +- .../test_global_organization_operations.py | 28 +- .../test_global_public_delegated_prefixes.py | 46 +- .../gapic/compute_v1/test_health_checks.py | 54 +-- tests/unit/gapic/compute_v1/test_images.py | 84 ++-- .../test_instance_group_managers.py | 177 ++++---- .../gapic/compute_v1/test_instance_groups.py | 84 ++-- .../compute_v1/test_instance_templates.py | 56 +-- tests/unit/gapic/compute_v1/test_instances.py | 367 +++++++++------- .../test_interconnect_attachments.py | 57 +-- .../compute_v1/test_interconnect_locations.py | 27 +- .../gapic/compute_v1/test_interconnects.py | 49 ++- .../gapic/compute_v1/test_license_codes.py | 31 +- tests/unit/gapic/compute_v1/test_licenses.py | 56 +-- .../gapic/compute_v1/test_machine_types.py | 34 +- .../test_network_endpoint_groups.py | 84 ++-- tests/unit/gapic/compute_v1/test_networks.py | 80 ++-- .../unit/gapic/compute_v1/test_node_groups.py | 118 ++--- .../gapic/compute_v1/test_node_templates.py | 73 +-- .../unit/gapic/compute_v1/test_node_types.py | 34 +- .../compute_v1/test_packet_mirrorings.py | 66 +-- tests/unit/gapic/compute_v1/test_projects.py | 74 ++-- .../test_public_advertised_prefixes.py | 50 ++- .../test_public_delegated_prefixes.py | 57 +-- .../compute_v1/test_region_autoscalers.py | 59 +-- .../test_region_backend_services.py | 72 +-- .../compute_v1/test_region_commitments.py | 41 +- .../compute_v1/test_region_disk_types.py | 31 +- .../gapic/compute_v1/test_region_disks.py | 115 ++--- .../test_region_health_check_services.py | 56 +-- .../compute_v1/test_region_health_checks.py | 63 +-- .../test_region_instance_group_managers.py | 176 ++++---- .../compute_v1/test_region_instance_groups.py | 49 ++- .../gapic/compute_v1/test_region_instances.py | 26 +- .../test_region_network_endpoint_groups.py | 47 +- .../test_region_notification_endpoints.py | 47 +- .../compute_v1/test_region_operations.py | 45 +- .../test_region_ssl_certificates.py | 45 +- .../test_region_target_http_proxies.py | 54 +-- .../test_region_target_https_proxies.py | 65 +-- .../gapic/compute_v1/test_region_url_maps.py | 72 +-- tests/unit/gapic/compute_v1/test_regions.py | 29 +- .../gapic/compute_v1/test_reservations.py | 82 ++-- .../compute_v1/test_resource_policies.py | 73 +-- tests/unit/gapic/compute_v1/test_routers.py | 91 ++-- tests/unit/gapic/compute_v1/test_routes.py | 39 +- .../compute_v1/test_security_policies.py | 71 +-- tests/unit/gapic/compute_v1/test_snapshots.py | 58 +-- .../gapic/compute_v1/test_ssl_certificates.py | 40 +- .../gapic/compute_v1/test_ssl_policies.py | 47 +- .../unit/gapic/compute_v1/test_subnetworks.py | 103 +++-- .../compute_v1/test_target_grpc_proxies.py | 44 +- .../compute_v1/test_target_http_proxies.py | 54 +-- .../compute_v1/test_target_https_proxies.py | 75 ++-- .../gapic/compute_v1/test_target_instances.py | 48 +- .../gapic/compute_v1/test_target_pools.py | 102 +++-- .../compute_v1/test_target_ssl_proxies.py | 65 +-- .../compute_v1/test_target_tcp_proxies.py | 51 ++- .../compute_v1/test_target_vpn_gateways.py | 48 +- tests/unit/gapic/compute_v1/test_url_maps.py | 68 +-- .../gapic/compute_v1/test_vpn_gateways.py | 73 +-- .../unit/gapic/compute_v1/test_vpn_tunnels.py | 48 +- .../gapic/compute_v1/test_zone_operations.py | 45 +- tests/unit/gapic/compute_v1/test_zones.py | 29 +- 157 files changed, 4218 insertions(+), 6534 deletions(-) diff --git a/google/cloud/compute_v1/services/accelerator_types/transports/rest.py b/google/cloud/compute_v1/services/accelerator_types/transports/rest.py index 627780859..65478651d 100644 --- a/google/cloud/compute_v1/services/accelerator_types/transports/rest.py +++ b/google/cloud/compute_v1/services/accelerator_types/transports/rest.py @@ -53,6 +53,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -86,7 +87,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -142,16 +146,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -206,16 +204,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -269,16 +261,10 @@ def list( if compute.ListAcceleratorTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/addresses/transports/rest.py b/google/cloud/compute_v1/services/addresses/transports/rest.py index 53b950908..f059a5498 100644 --- a/google/cloud/compute_v1/services/addresses/transports/rest.py +++ b/google/cloud/compute_v1/services/addresses/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListAddressesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteAddressRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -305,16 +297,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -393,16 +379,12 @@ def insert( if compute.InsertAddressRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -453,16 +435,10 @@ def list( if compute.ListAddressesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/autoscalers/transports/rest.py b/google/cloud/compute_v1/services/autoscalers/transports/rest.py index f1541cb79..2e6d2a61e 100644 --- a/google/cloud/compute_v1/services/autoscalers/transports/rest.py +++ b/google/cloud/compute_v1/services/autoscalers/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListAutoscalersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -298,16 +290,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -388,16 +374,12 @@ def insert( if compute.InsertAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -451,16 +433,10 @@ def list( if compute.ListAutoscalersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -543,16 +519,12 @@ def patch( if compute.PatchAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -633,16 +605,12 @@ def update( if compute.UpdateAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/backend_buckets/transports/rest.py b/google/cloud/compute_v1/services/backend_buckets/transports/rest.py index ee9bc6b8e..0c4cc8179 100644 --- a/google/cloud/compute_v1/services/backend_buckets/transports/rest.py +++ b/google/cloud/compute_v1/services/backend_buckets/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -165,16 +169,12 @@ def add_signed_url_key( if compute.AddSignedUrlKeyBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -248,16 +248,10 @@ def delete( if compute.DeleteBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -328,21 +322,14 @@ def delete_signed_url_key( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.key_name: - query_params["keyName"] = request.key_name + query_params["keyName"] = request.key_name if compute.DeleteSignedUrlKeyBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -392,16 +379,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -482,16 +463,12 @@ def insert( if compute.InsertBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -545,16 +522,10 @@ def list( if compute.ListBackendBucketsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -637,16 +608,12 @@ def patch( if compute.PatchBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -727,16 +694,12 @@ def update( if compute.UpdateBackendBucketRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/backend_services/transports/rest.py b/google/cloud/compute_v1/services/backend_services/transports/rest.py index 86fc6473f..842d610aa 100644 --- a/google/cloud/compute_v1/services/backend_services/transports/rest.py +++ b/google/cloud/compute_v1/services/backend_services/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -165,16 +169,12 @@ def add_signed_url_key( if compute.AddSignedUrlKeyBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -233,16 +233,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -318,16 +312,10 @@ def delete( if compute.DeleteBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -398,21 +386,14 @@ def delete_signed_url_key( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.key_name: - query_params["keyName"] = request.key_name + query_params["keyName"] = request.key_name if compute.DeleteSignedUrlKeyBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -478,16 +459,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -540,16 +515,12 @@ def get_health( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -630,16 +601,12 @@ def insert( if compute.InsertBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -693,16 +660,10 @@ def list( if compute.ListBackendServicesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -785,16 +746,12 @@ def patch( if compute.PatchBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -875,16 +832,12 @@ def set_security_policy( if compute.SetSecurityPolicyBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -965,16 +918,12 @@ def update( if compute.UpdateBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/disk_types/transports/rest.py b/google/cloud/compute_v1/services/disk_types/transports/rest.py index 18e4260d0..5a874146a 100644 --- a/google/cloud/compute_v1/services/disk_types/transports/rest.py +++ b/google/cloud/compute_v1/services/disk_types/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListDiskTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -213,16 +211,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -273,16 +265,10 @@ def list( if compute.ListDiskTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/disks/transports/rest.py b/google/cloud/compute_v1/services/disks/transports/rest.py index 77dfec062..36145f2f7 100644 --- a/google/cloud/compute_v1/services/disks/transports/rest.py +++ b/google/cloud/compute_v1/services/disks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def add_resource_policies( if compute.AddResourcePoliciesDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -229,16 +229,10 @@ def aggregated_list( if compute.AggregatedListDisksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -324,16 +318,12 @@ def create_snapshot( if compute.CreateSnapshotDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -407,16 +397,10 @@ def delete( if compute.DeleteDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -480,16 +464,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -588,16 +566,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -677,16 +649,12 @@ def insert( if compute.InsertDiskRequest.source_image in request: query_params["sourceImage"] = request.source_image - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -737,16 +705,10 @@ def list( if compute.ListDisksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -828,16 +790,12 @@ def remove_resource_policies( if compute.RemoveResourcePoliciesDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -918,16 +876,12 @@ def resize( if compute.ResizeDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1029,16 +983,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1120,16 +1070,12 @@ def set_labels( if compute.SetLabelsDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1181,16 +1127,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py b/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py index 989d8fb0c..c7465948b 100644 --- a/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py +++ b/google/cloud/compute_v1/services/external_vpn_gateways/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteExternalVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -226,16 +224,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -316,16 +308,12 @@ def insert( if compute.InsertExternalVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -379,16 +367,10 @@ def list( if compute.ListExternalVpnGatewaysRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -467,16 +449,12 @@ def set_labels( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -525,16 +503,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/firewall_policies/transports/rest.py b/google/cloud/compute_v1/services/firewall_policies/transports/rest.py index b543ca504..54c6d9230 100644 --- a/google/cloud/compute_v1/services/firewall_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/firewall_policies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -170,16 +174,12 @@ def add_association( if compute.AddAssociationFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -258,16 +258,12 @@ def add_rule( if compute.AddRuleFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -341,16 +337,10 @@ def clone_rules( if compute.CloneRulesFirewallPolicyRequest.source_firewall_policy in request: query_params["sourceFirewallPolicy"] = request.source_firewall_policy - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -422,16 +412,10 @@ def delete( if compute.DeleteFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -475,16 +459,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -530,16 +508,10 @@ def get_association( if compute.GetAssociationFirewallPolicyRequest.name in request: query_params["name"] = request.name - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -640,16 +612,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -697,16 +663,10 @@ def get_rule( if compute.GetRuleFirewallPolicyRequest.priority in request: query_params["priority"] = request.priority - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -789,16 +749,12 @@ def insert( if compute.InsertFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -852,16 +808,10 @@ def list( if compute.ListFirewallPoliciesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -907,16 +857,10 @@ def list_associations( if compute.ListAssociationsFirewallPolicyRequest.target_resource in request: query_params["targetResource"] = request.target_resource - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -992,16 +936,10 @@ def move( if compute.MoveFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1080,16 +1018,12 @@ def patch( if compute.PatchFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1170,16 +1104,12 @@ def patch_rule( if compute.PatchRuleFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1253,16 +1183,10 @@ def remove_association( if compute.RemoveAssociationFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1336,16 +1260,10 @@ def remove_rule( if compute.RemoveRuleFirewallPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1444,16 +1362,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1502,16 +1416,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/firewalls/transports/rest.py b/google/cloud/compute_v1/services/firewalls/transports/rest.py index fed614c14..f751902f3 100644 --- a/google/cloud/compute_v1/services/firewalls/transports/rest.py +++ b/google/cloud/compute_v1/services/firewalls/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def delete( if compute.DeleteFirewallRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -211,16 +209,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -299,16 +291,12 @@ def insert( if compute.InsertFirewallRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -359,16 +347,10 @@ def list( if compute.ListFirewallsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -449,16 +431,12 @@ def patch( if compute.PatchFirewallRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -537,16 +515,12 @@ def update( if compute.UpdateFirewallRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/forwarding_rules/transports/rest.py b/google/cloud/compute_v1/services/forwarding_rules/transports/rest.py index 73881b20d..61938b0e9 100644 --- a/google/cloud/compute_v1/services/forwarding_rules/transports/rest.py +++ b/google/cloud/compute_v1/services/forwarding_rules/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -227,16 +225,10 @@ def delete( if compute.DeleteForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -303,16 +295,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -393,16 +379,12 @@ def insert( if compute.InsertForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -456,16 +438,10 @@ def list( if compute.ListForwardingRulesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -549,16 +525,12 @@ def patch( if compute.PatchForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -640,16 +612,12 @@ def set_labels( if compute.SetLabelsForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -731,16 +699,12 @@ def set_target( if compute.SetTargetForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_addresses/transports/rest.py b/google/cloud/compute_v1/services/global_addresses/transports/rest.py index faa556af4..c1e9e2748 100644 --- a/google/cloud/compute_v1/services/global_addresses/transports/rest.py +++ b/google/cloud/compute_v1/services/global_addresses/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def delete( if compute.DeleteGlobalAddressRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -235,16 +233,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -323,16 +315,12 @@ def insert( if compute.InsertGlobalAddressRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -384,16 +372,10 @@ def list( if compute.ListGlobalAddressesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_forwarding_rules/transports/rest.py b/google/cloud/compute_v1/services/global_forwarding_rules/transports/rest.py index ffe0c27b1..ad44a5280 100644 --- a/google/cloud/compute_v1/services/global_forwarding_rules/transports/rest.py +++ b/google/cloud/compute_v1/services/global_forwarding_rules/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteGlobalForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -233,16 +231,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -323,16 +315,12 @@ def insert( if compute.InsertGlobalForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -386,16 +374,10 @@ def list( if compute.ListGlobalForwardingRulesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -478,16 +460,12 @@ def patch( if compute.PatchGlobalForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -564,16 +542,12 @@ def set_labels( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -654,16 +628,12 @@ def set_target( if compute.SetTargetGlobalForwardingRuleRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py index 9a311b2b6..37a923eb1 100644 --- a/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/global_network_endpoint_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -168,16 +172,12 @@ def attach_network_endpoints( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -251,16 +251,10 @@ def delete( if compute.DeleteGlobalNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -344,16 +338,12 @@ def detach_network_endpoints( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -410,16 +400,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -500,16 +484,12 @@ def insert( if compute.InsertGlobalNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -564,16 +544,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -644,16 +618,10 @@ def list_network_endpoints( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_operations/transports/rest.py b/google/cloud/compute_v1/services/global_operations/transports/rest.py index 07c85796a..48656cd0d 100644 --- a/google/cloud/compute_v1/services/global_operations/transports/rest.py +++ b/google/cloud/compute_v1/services/global_operations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -197,16 +195,10 @@ def delete( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -278,16 +270,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -341,16 +327,10 @@ def list( if compute.ListGlobalOperationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -422,16 +402,10 @@ def wait( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py b/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py index 6c8b90dcb..7c9719206 100644 --- a/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py +++ b/google/cloud/compute_v1/services/global_organization_operations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -131,16 +135,10 @@ def delete( if compute.DeleteGlobalOrganizationOperationRequest.parent_id in request: query_params["parentId"] = request.parent_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -214,16 +212,10 @@ def get( if compute.GetGlobalOrganizationOperationRequest.parent_id in request: query_params["parentId"] = request.parent_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -282,16 +274,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/rest.py b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/rest.py index 577054bca..c82370155 100644 --- a/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/rest.py +++ b/google/cloud/compute_v1/services/global_public_delegated_prefixes/transports/rest.py @@ -54,6 +54,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -87,7 +88,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -160,16 +164,10 @@ def delete( if compute.DeleteGlobalPublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -222,16 +220,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -312,16 +304,12 @@ def insert( if compute.InsertGlobalPublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -376,16 +364,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -468,16 +450,12 @@ def patch( if compute.PatchGlobalPublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/health_checks/transports/rest.py b/google/cloud/compute_v1/services/health_checks/transports/rest.py index e1271e5cf..63fa8e598 100644 --- a/google/cloud/compute_v1/services/health_checks/transports/rest.py +++ b/google/cloud/compute_v1/services/health_checks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListHealthChecksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -221,16 +219,10 @@ def delete( if compute.DeleteHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -300,16 +292,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -390,16 +376,12 @@ def insert( if compute.InsertHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -453,16 +435,10 @@ def list( if compute.ListHealthChecksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -543,16 +519,12 @@ def patch( if compute.PatchHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -631,16 +603,12 @@ def update( if compute.UpdateHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/images/transports/rest.py b/google/cloud/compute_v1/services/images/transports/rest.py index 9ee104adb..0995dd0a7 100644 --- a/google/cloud/compute_v1/services/images/transports/rest.py +++ b/google/cloud/compute_v1/services/images/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -155,16 +159,10 @@ def delete( if compute.DeleteImageRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -243,16 +241,12 @@ def deprecate( if compute.DeprecateImageRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -298,16 +292,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -354,16 +342,10 @@ def get_from_family( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -459,16 +441,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -548,16 +524,12 @@ def insert( if compute.InsertImageRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -608,16 +580,10 @@ def list( if compute.ListImagesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -695,16 +661,12 @@ def patch( if compute.PatchImageRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -803,16 +765,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -889,16 +847,12 @@ def set_labels( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -947,16 +901,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py b/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py index e23838ca8..723448416 100644 --- a/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py +++ b/google/cloud/compute_v1/services/instance_group_managers/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def abandon_instances( if compute.AbandonInstancesInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -235,16 +235,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -327,16 +321,12 @@ def apply_updates_to_instances( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -418,16 +408,12 @@ def create_instances( if compute.CreateInstancesInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -502,16 +488,10 @@ def delete( if compute.DeleteInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -593,16 +573,12 @@ def delete_instances( if compute.DeleteInstancesInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -683,16 +659,12 @@ def delete_per_instance_configs( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -751,16 +723,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -841,16 +807,12 @@ def insert( if compute.InsertInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -902,16 +864,10 @@ def list( if compute.ListInstanceGroupManagersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -971,16 +927,10 @@ def list_errors( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1046,16 +996,10 @@ def list_managed_instances( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1124,16 +1068,10 @@ def list_per_instance_configs( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1217,16 +1155,12 @@ def patch( if compute.PatchInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1312,16 +1246,12 @@ def patch_per_instance_configs( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1403,16 +1333,12 @@ def recreate_instances( if compute.RecreateInstancesInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1486,19 +1412,12 @@ def resize( query_params = {} if compute.ResizeInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - if request.size: - query_params["size"] = request.size - - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") + query_params["size"] = request.size # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1580,16 +1499,12 @@ def set_instance_template( if compute.SetInstanceTemplateInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1671,16 +1586,12 @@ def set_target_pools( if compute.SetTargetPoolsInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1766,16 +1677,12 @@ def update_per_instance_configs( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/instance_groups/transports/rest.py b/google/cloud/compute_v1/services/instance_groups/transports/rest.py index 3cace55f6..2eb6550e6 100644 --- a/google/cloud/compute_v1/services/instance_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/instance_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def add_instances( if compute.AddInstancesInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -232,16 +232,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -318,16 +312,10 @@ def delete( if compute.DeleteInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -392,16 +380,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -482,16 +464,12 @@ def insert( if compute.InsertInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -543,16 +521,10 @@ def list( if compute.ListInstanceGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -616,16 +588,12 @@ def list_instances( if compute.ListInstancesInstanceGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -709,16 +677,12 @@ def remove_instances( if compute.RemoveInstancesInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -800,16 +764,12 @@ def set_named_ports( if compute.SetNamedPortsInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/instance_templates/transports/rest.py b/google/cloud/compute_v1/services/instance_templates/transports/rest.py index b76edeb0f..494c31c75 100644 --- a/google/cloud/compute_v1/services/instance_templates/transports/rest.py +++ b/google/cloud/compute_v1/services/instance_templates/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteInstanceTemplateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -217,16 +215,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -327,16 +319,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -415,16 +401,12 @@ def insert( if compute.InsertInstanceTemplateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -476,16 +458,10 @@ def list( if compute.ListInstanceTemplatesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -586,16 +562,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -644,16 +616,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/instances/transports/rest.py b/google/cloud/compute_v1/services/instances/transports/rest.py index e4adb2932..af8df32fd 100644 --- a/google/cloud/compute_v1/services/instances/transports/rest.py +++ b/google/cloud/compute_v1/services/instances/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -163,21 +167,16 @@ def add_access_config( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.network_interface: - query_params["networkInterface"] = request.network_interface + query_params["networkInterface"] = request.network_interface if compute.AddAccessConfigInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -259,16 +258,12 @@ def add_resource_policies( if compute.AddResourcePoliciesInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -322,16 +317,10 @@ def aggregated_list( if compute.AggregatedListInstancesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -417,16 +406,12 @@ def attach_disk( if compute.AttachDiskInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -505,16 +490,12 @@ def bulk_insert( if compute.BulkInsertInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -589,16 +570,10 @@ def delete( if compute.DeleteInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -670,23 +645,15 @@ def delete_access_config( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.access_config: - query_params["accessConfig"] = request.access_config - if request.network_interface: - query_params["networkInterface"] = request.network_interface + query_params["accessConfig"] = request.access_config + query_params["networkInterface"] = request.network_interface if compute.DeleteAccessConfigInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -758,21 +725,14 @@ def detach_disk( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.device_name: - query_params["deviceName"] = request.device_name + query_params["deviceName"] = request.device_name if compute.DetachDiskInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -822,16 +782,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -875,19 +829,12 @@ def get_effective_firewalls( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.network_interface: - query_params["networkInterface"] = request.network_interface - - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") + query_params["networkInterface"] = request.network_interface # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -938,16 +885,10 @@ def get_guest_attributes( if compute.GetGuestAttributesInstanceRequest.variable_key in request: query_params["variableKey"] = request.variable_key - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1051,16 +992,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1105,16 +1040,10 @@ def get_screenshot( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1165,16 +1094,10 @@ def get_serial_port_output( if compute.GetSerialPortOutputInstanceRequest.start in request: query_params["start"] = request.start - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1222,16 +1145,10 @@ def get_shielded_instance_identity( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1314,16 +1231,12 @@ def insert( if compute.InsertInstanceRequest.source_instance_template in request: query_params["sourceInstanceTemplate"] = request.source_instance_template - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1374,16 +1287,10 @@ def list( if compute.ListInstancesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1442,16 +1349,10 @@ def list_referrers( if compute.ListReferrersInstancesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1535,16 +1436,12 @@ def remove_resource_policies( if compute.RemoveResourcePoliciesInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1619,16 +1516,10 @@ def reset( if compute.ResetInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1705,16 +1596,10 @@ def set_deletion_protection( if compute.SetDeletionProtectionInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1786,23 +1671,15 @@ def set_disk_auto_delete( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.auto_delete: - query_params["autoDelete"] = request.auto_delete - if request.device_name: - query_params["deviceName"] = request.device_name + query_params["autoDelete"] = request.auto_delete + query_params["deviceName"] = request.device_name if compute.SetDiskAutoDeleteInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1904,16 +1781,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1995,16 +1868,12 @@ def set_labels( if compute.SetLabelsInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2086,16 +1955,12 @@ def set_machine_resources( if compute.SetMachineResourcesInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2177,16 +2042,12 @@ def set_machine_type( if compute.SetMachineTypeInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2268,16 +2129,12 @@ def set_metadata( if compute.SetMetadataInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2359,16 +2216,12 @@ def set_min_cpu_platform( if compute.SetMinCpuPlatformInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2450,16 +2303,12 @@ def set_scheduling( if compute.SetSchedulingInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2541,16 +2390,12 @@ def set_service_account( if compute.SetServiceAccountInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2636,16 +2481,12 @@ def set_shielded_instance_integrity_policy( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2727,16 +2568,12 @@ def set_tags( if compute.SetTagsInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2810,16 +2647,10 @@ def simulate_maintenance_event( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2894,16 +2725,10 @@ def start( if compute.StartInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -2985,16 +2810,12 @@ def start_with_encryption_key( if compute.StartWithEncryptionKeyInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3068,16 +2889,10 @@ def stop( if compute.StopInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3129,16 +2944,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3228,16 +3039,12 @@ def update( if compute.UpdateInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3316,21 +3123,16 @@ def update_access_config( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.network_interface: - query_params["networkInterface"] = request.network_interface + query_params["networkInterface"] = request.network_interface if compute.UpdateAccessConfigInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3412,16 +3214,12 @@ def update_display_device( if compute.UpdateDisplayDeviceInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3500,21 +3298,16 @@ def update_network_interface( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.network_interface: - query_params["networkInterface"] = request.network_interface + query_params["networkInterface"] = request.network_interface if compute.UpdateNetworkInterfaceInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -3597,16 +3390,12 @@ def update_shielded_instance_config( if compute.UpdateShieldedInstanceConfigInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py b/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py index bed80622b..7ad833014 100644 --- a/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py +++ b/google/cloud/compute_v1/services/interconnect_attachments/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -144,16 +148,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -230,16 +228,10 @@ def delete( if compute.DeleteInterconnectAttachmentRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -291,16 +283,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -383,16 +369,12 @@ def insert( if compute.InsertInterconnectAttachmentRequest.validate_only in request: query_params["validateOnly"] = request.validate_only - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -447,16 +429,10 @@ def list( if compute.ListInterconnectAttachmentsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -540,16 +516,12 @@ def patch( if compute.PatchInterconnectAttachmentRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/interconnect_locations/transports/rest.py b/google/cloud/compute_v1/services/interconnect_locations/transports/rest.py index c85766d96..2a0a9ba60 100644 --- a/google/cloud/compute_v1/services/interconnect_locations/transports/rest.py +++ b/google/cloud/compute_v1/services/interconnect_locations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -135,16 +139,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -201,16 +199,10 @@ def list( if compute.ListInterconnectLocationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/interconnects/transports/rest.py b/google/cloud/compute_v1/services/interconnects/transports/rest.py index 56a3cd00c..36167e41a 100644 --- a/google/cloud/compute_v1/services/interconnects/transports/rest.py +++ b/google/cloud/compute_v1/services/interconnects/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def delete( if compute.DeleteInterconnectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -214,16 +212,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -269,16 +261,10 @@ def get_diagnostics( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -359,16 +345,12 @@ def insert( if compute.InsertInterconnectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -422,16 +404,10 @@ def list( if compute.ListInterconnectsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -512,16 +488,12 @@ def patch( if compute.PatchInterconnectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/license_codes/transports/rest.py b/google/cloud/compute_v1/services/license_codes/transports/rest.py index 3e5e11f7c..c62ef553e 100644 --- a/google/cloud/compute_v1/services/license_codes/transports/rest.py +++ b/google/cloud/compute_v1/services/license_codes/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -133,16 +137,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -193,16 +191,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/licenses/transports/rest.py b/google/cloud/compute_v1/services/licenses/transports/rest.py index 2077ae269..c35bbf587 100644 --- a/google/cloud/compute_v1/services/licenses/transports/rest.py +++ b/google/cloud/compute_v1/services/licenses/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -153,21 +157,14 @@ def delete( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.license_: - query_params["license"] = request.license_ + query_params["license"] = request.license_ if compute.DeleteLicenseRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -214,19 +211,12 @@ def get( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.license_: - query_params["license"] = request.license_ - - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") + query_params["license"] = request.license_ # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -325,16 +315,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -413,16 +397,12 @@ def insert( if compute.InsertLicenseRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -473,16 +453,10 @@ def list( if compute.ListLicensesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -583,16 +557,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -641,16 +611,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/machine_types/transports/rest.py b/google/cloud/compute_v1/services/machine_types/transports/rest.py index 7ccc4c533..ad377ff30 100644 --- a/google/cloud/compute_v1/services/machine_types/transports/rest.py +++ b/google/cloud/compute_v1/services/machine_types/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListMachineTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -200,16 +198,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -263,16 +255,10 @@ def list( if compute.ListMachineTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py b/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py index 379877dff..2e485ef0c 100644 --- a/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/network_endpoint_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -144,16 +148,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -240,16 +238,12 @@ def attach_network_endpoints( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -324,16 +318,10 @@ def delete( if compute.DeleteNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -418,16 +406,12 @@ def detach_network_endpoints( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -485,16 +469,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -575,16 +553,12 @@ def insert( if compute.InsertNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -636,16 +610,10 @@ def list( if compute.ListNetworkEndpointGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -718,16 +686,12 @@ def list_network_endpoints( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -781,16 +745,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/networks/transports/rest.py b/google/cloud/compute_v1/services/networks/transports/rest.py index 49cf5043c..b843ea546 100644 --- a/google/cloud/compute_v1/services/networks/transports/rest.py +++ b/google/cloud/compute_v1/services/networks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -163,16 +167,12 @@ def add_peering( if compute.AddPeeringNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -244,16 +244,10 @@ def delete( if compute.DeleteNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -300,16 +294,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -351,16 +339,10 @@ def get_effective_firewalls( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -441,16 +423,12 @@ def insert( if compute.InsertNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -501,16 +479,10 @@ def list( if compute.ListNetworksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -570,16 +542,10 @@ def list_peering_routes( if compute.ListPeeringRoutesNetworksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -659,16 +625,12 @@ def patch( if compute.PatchNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -747,16 +709,12 @@ def remove_peering( if compute.RemovePeeringNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -828,16 +786,10 @@ def switch_to_custom_mode( if compute.SwitchToCustomModeNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -916,16 +868,12 @@ def update_peering( if compute.UpdatePeeringNetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/node_groups/transports/rest.py b/google/cloud/compute_v1/services/node_groups/transports/rest.py index f8d959868..eff7a170a 100644 --- a/google/cloud/compute_v1/services/node_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/node_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def add_nodes( if compute.AddNodesNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -229,16 +229,10 @@ def aggregated_list( if compute.AggregatedListNodeGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -315,16 +309,10 @@ def delete( if compute.DeleteNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -406,16 +394,12 @@ def delete_nodes( if compute.DeleteNodesNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -468,16 +452,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -579,16 +557,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -664,21 +636,16 @@ def insert( # TODO(yon-mg): handle nested fields corerctly rather than using only top level fields # not required for GCE query_params = {} - if request.initial_node_count: - query_params["initialNodeCount"] = request.initial_node_count + query_params["initialNodeCount"] = request.initial_node_count if compute.InsertNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -730,16 +697,10 @@ def list( if compute.ListNodeGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -796,16 +757,10 @@ def list_nodes( if compute.ListNodesNodeGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -889,16 +844,12 @@ def patch( if compute.PatchNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1000,16 +951,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1091,16 +1038,12 @@ def set_node_template( if compute.SetNodeTemplateNodeGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1152,16 +1095,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/node_templates/transports/rest.py b/google/cloud/compute_v1/services/node_templates/transports/rest.py index ebc7d23d1..a0e261096 100644 --- a/google/cloud/compute_v1/services/node_templates/transports/rest.py +++ b/google/cloud/compute_v1/services/node_templates/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListNodeTemplatesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteNodeTemplateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -284,16 +276,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -397,16 +383,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -485,16 +465,12 @@ def insert( if compute.InsertNodeTemplateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -546,16 +522,10 @@ def list( if compute.ListNodeTemplatesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -659,16 +629,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -720,16 +686,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/node_types/transports/rest.py b/google/cloud/compute_v1/services/node_types/transports/rest.py index 021b92189..c37f08a39 100644 --- a/google/cloud/compute_v1/services/node_types/transports/rest.py +++ b/google/cloud/compute_v1/services/node_types/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListNodeTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -202,16 +200,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -262,16 +254,10 @@ def list( if compute.ListNodeTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/packet_mirrorings/transports/rest.py b/google/cloud/compute_v1/services/packet_mirrorings/transports/rest.py index a16718654..93e9c68be 100644 --- a/google/cloud/compute_v1/services/packet_mirrorings/transports/rest.py +++ b/google/cloud/compute_v1/services/packet_mirrorings/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -227,16 +225,10 @@ def delete( if compute.DeletePacketMirroringRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -290,16 +282,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -380,16 +366,12 @@ def insert( if compute.InsertPacketMirroringRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -443,16 +425,10 @@ def list( if compute.ListPacketMirroringsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -536,16 +512,12 @@ def patch( if compute.PatchPacketMirroringRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -597,16 +569,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/projects/transports/rest.py b/google/cloud/compute_v1/services/projects/transports/rest.py index b47df2c13..6c1510d6c 100644 --- a/google/cloud/compute_v1/services/projects/transports/rest.py +++ b/google/cloud/compute_v1/services/projects/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def disable_xpn_host( if compute.DisableXpnHostProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -244,16 +242,12 @@ def disable_xpn_resource( if compute.DisableXpnResourceProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -325,16 +319,10 @@ def enable_xpn_host( if compute.EnableXpnHostProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -413,16 +401,12 @@ def enable_xpn_resource( if compute.EnableXpnResourceProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -469,16 +453,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -526,16 +504,10 @@ def get_xpn_host( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -587,16 +559,10 @@ def get_xpn_resources( if compute.GetXpnResourcesProjectsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -657,16 +623,12 @@ def list_xpn_hosts( if compute.ListXpnHostsProjectsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -747,16 +709,12 @@ def move_disk( if compute.MoveDiskProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -835,16 +793,12 @@ def move_instance( if compute.MoveInstanceProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -924,16 +878,12 @@ def set_common_instance_metadata( if compute.SetCommonInstanceMetadataProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1012,16 +962,12 @@ def set_default_network_tier( if compute.SetDefaultNetworkTierProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1100,16 +1046,12 @@ def set_usage_export_bucket( if compute.SetUsageExportBucketProjectRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/rest.py b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/rest.py index f08dbd5eb..7e73748dc 100644 --- a/google/cloud/compute_v1/services/public_advertised_prefixes/transports/rest.py +++ b/google/cloud/compute_v1/services/public_advertised_prefixes/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeletePublicAdvertisedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -217,16 +215,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -307,16 +299,12 @@ def insert( if compute.InsertPublicAdvertisedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -371,16 +359,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -463,16 +445,12 @@ def patch( if compute.PatchPublicAdvertisedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py index b4f3b5d04..6c22d7efe 100644 --- a/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py +++ b/google/cloud/compute_v1/services/public_delegated_prefixes/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -144,16 +148,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -230,16 +228,10 @@ def delete( if compute.DeletePublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -293,16 +285,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -383,16 +369,12 @@ def insert( if compute.InsertPublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -444,16 +426,10 @@ def list( if compute.ListPublicDelegatedPrefixesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -537,16 +513,12 @@ def patch( if compute.PatchPublicDelegatedPrefixeRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_autoscalers/transports/rest.py b/google/cloud/compute_v1/services/region_autoscalers/transports/rest.py index 6fec05122..5758cfa92 100644 --- a/google/cloud/compute_v1/services/region_autoscalers/transports/rest.py +++ b/google/cloud/compute_v1/services/region_autoscalers/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -233,16 +231,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -323,16 +315,12 @@ def insert( if compute.InsertRegionAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -384,16 +372,10 @@ def list( if compute.ListRegionAutoscalersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -476,16 +458,12 @@ def patch( if compute.PatchRegionAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -566,16 +544,12 @@ def update( if compute.UpdateRegionAutoscalerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_backend_services/transports/rest.py b/google/cloud/compute_v1/services/region_backend_services/transports/rest.py index 689be35a9..e0f80a578 100644 --- a/google/cloud/compute_v1/services/region_backend_services/transports/rest.py +++ b/google/cloud/compute_v1/services/region_backend_services/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -235,16 +233,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -298,16 +290,12 @@ def get_health( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -388,16 +376,12 @@ def insert( if compute.InsertRegionBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -451,16 +435,10 @@ def list( if compute.ListRegionBackendServicesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -544,16 +522,12 @@ def patch( if compute.PatchRegionBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -635,16 +609,12 @@ def update( if compute.UpdateRegionBackendServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_commitments/transports/rest.py b/google/cloud/compute_v1/services/region_commitments/transports/rest.py index 7f09ed704..91db4d797 100644 --- a/google/cloud/compute_v1/services/region_commitments/transports/rest.py +++ b/google/cloud/compute_v1/services/region_commitments/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -206,16 +204,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -296,16 +288,12 @@ def insert( if compute.InsertRegionCommitmentRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -359,16 +347,10 @@ def list( if compute.ListRegionCommitmentsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_disk_types/transports/rest.py b/google/cloud/compute_v1/services/region_disk_types/transports/rest.py index b30cf3f3f..084869510 100644 --- a/google/cloud/compute_v1/services/region_disk_types/transports/rest.py +++ b/google/cloud/compute_v1/services/region_disk_types/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -149,16 +153,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -210,16 +208,10 @@ def list( if compute.ListRegionDiskTypesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_disks/transports/rest.py b/google/cloud/compute_v1/services/region_disks/transports/rest.py index 8aa9d1e9f..8a3e9fdc1 100644 --- a/google/cloud/compute_v1/services/region_disks/transports/rest.py +++ b/google/cloud/compute_v1/services/region_disks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def add_resource_policies( if compute.AddResourcePoliciesRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -257,16 +257,12 @@ def create_snapshot( if compute.CreateSnapshotRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -341,16 +337,10 @@ def delete( if compute.DeleteRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -415,16 +405,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -526,16 +510,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -616,16 +594,12 @@ def insert( if compute.InsertRegionDiskRequest.source_image in request: query_params["sourceImage"] = request.source_image - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -677,16 +651,10 @@ def list( if compute.ListRegionDisksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -768,16 +736,12 @@ def remove_resource_policies( if compute.RemoveResourcePoliciesRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -859,16 +823,12 @@ def resize( if compute.ResizeRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -970,16 +930,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1061,16 +1017,12 @@ def set_labels( if compute.SetLabelsRegionDiskRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1122,16 +1074,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_health_check_services/transports/rest.py b/google/cloud/compute_v1/services/region_health_check_services/transports/rest.py index 162ac4fc8..afd42000e 100644 --- a/google/cloud/compute_v1/services/region_health_check_services/transports/rest.py +++ b/google/cloud/compute_v1/services/region_health_check_services/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionHealthCheckServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -217,16 +215,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -307,16 +299,12 @@ def insert( if compute.InsertRegionHealthCheckServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -371,16 +359,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -464,16 +446,12 @@ def patch( if compute.PatchRegionHealthCheckServiceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_health_checks/transports/rest.py b/google/cloud/compute_v1/services/region_health_checks/transports/rest.py index 2f1892136..ecf62c3f4 100644 --- a/google/cloud/compute_v1/services/region_health_checks/transports/rest.py +++ b/google/cloud/compute_v1/services/region_health_checks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -241,16 +239,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -331,16 +323,12 @@ def insert( if compute.InsertRegionHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -394,16 +382,10 @@ def list( if compute.ListRegionHealthChecksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -487,16 +469,12 @@ def patch( if compute.PatchRegionHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -578,16 +556,12 @@ def update( if compute.UpdateRegionHealthCheckRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py b/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py index 5fbb3771f..f3ffd371c 100644 --- a/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py +++ b/google/cloud/compute_v1/services/region_instance_group_managers/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -169,16 +173,12 @@ def abandon_instances( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -259,16 +259,12 @@ def apply_updates_to_instances( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -353,16 +349,12 @@ def create_instances( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -437,16 +429,10 @@ def delete( if compute.DeleteRegionInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -531,16 +517,12 @@ def delete_instances( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -621,16 +603,12 @@ def delete_per_instance_configs( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -689,16 +667,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -779,16 +751,12 @@ def insert( if compute.InsertRegionInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -845,16 +813,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -914,16 +876,10 @@ def list_errors( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -995,16 +951,10 @@ def list_managed_instances( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1076,16 +1026,10 @@ def list_per_instance_configs( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1169,16 +1113,12 @@ def patch( if compute.PatchRegionInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1264,16 +1204,12 @@ def patch_per_instance_configs( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1358,16 +1294,12 @@ def recreate_instances( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1441,19 +1373,12 @@ def resize( query_params = {} if compute.ResizeRegionInstanceGroupManagerRequest.request_id in request: query_params["requestId"] = request.request_id - if request.size: - query_params["size"] = request.size - - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") + query_params["size"] = request.size # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1538,16 +1463,12 @@ def set_instance_template( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1632,16 +1553,12 @@ def set_target_pools( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1727,16 +1644,12 @@ def update_per_instance_configs( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_instance_groups/transports/rest.py b/google/cloud/compute_v1/services/region_instance_groups/transports/rest.py index ef84b6dac..d292688b1 100644 --- a/google/cloud/compute_v1/services/region_instance_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/region_instance_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -149,16 +153,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -214,16 +212,10 @@ def list( if compute.ListRegionInstanceGroupsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -290,16 +282,12 @@ def list_instances( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -383,16 +371,12 @@ def set_named_ports( if compute.SetNamedPortsRegionInstanceGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_instances/transports/rest.py b/google/cloud/compute_v1/services/region_instances/transports/rest.py index 2231e5fd6..eecc61e45 100644 --- a/google/cloud/compute_v1/services/region_instances/transports/rest.py +++ b/google/cloud/compute_v1/services/region_instances/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -163,16 +167,12 @@ def bulk_insert( if compute.BulkInsertRegionInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/rest.py b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/rest.py index 9ae255c0d..368138aec 100644 --- a/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/rest.py +++ b/google/cloud/compute_v1/services/region_network_endpoint_groups/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -226,16 +224,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -316,16 +308,12 @@ def insert( if compute.InsertRegionNetworkEndpointGroupRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -380,16 +368,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_notification_endpoints/transports/rest.py b/google/cloud/compute_v1/services/region_notification_endpoints/transports/rest.py index 8d82c8a7a..19604f40b 100644 --- a/google/cloud/compute_v1/services/region_notification_endpoints/transports/rest.py +++ b/google/cloud/compute_v1/services/region_notification_endpoints/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionNotificationEndpointRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -223,16 +221,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -313,16 +305,12 @@ def insert( if compute.InsertRegionNotificationEndpointRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -377,16 +365,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_operations/transports/rest.py b/google/cloud/compute_v1/services/region_operations/transports/rest.py index a6ad11cb6..9a98a8e72 100644 --- a/google/cloud/compute_v1/services/region_operations/transports/rest.py +++ b/google/cloud/compute_v1/services/region_operations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -132,16 +136,10 @@ def delete( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -216,16 +214,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -279,16 +271,10 @@ def list( if compute.ListRegionOperationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -363,16 +349,10 @@ def wait( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_ssl_certificates/transports/rest.py b/google/cloud/compute_v1/services/region_ssl_certificates/transports/rest.py index a7a8e1667..23813cc42 100644 --- a/google/cloud/compute_v1/services/region_ssl_certificates/transports/rest.py +++ b/google/cloud/compute_v1/services/region_ssl_certificates/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionSslCertificateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -239,16 +237,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -329,16 +321,12 @@ def insert( if compute.InsertRegionSslCertificateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -392,16 +380,10 @@ def list( if compute.ListRegionSslCertificatesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_target_http_proxies/transports/rest.py b/google/cloud/compute_v1/services/region_target_http_proxies/transports/rest.py index 77fe37895..6168212e0 100644 --- a/google/cloud/compute_v1/services/region_target_http_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/region_target_http_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -236,16 +234,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -326,16 +318,12 @@ def insert( if compute.InsertRegionTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -387,16 +375,10 @@ def list( if compute.ListRegionTargetHttpProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -480,16 +462,12 @@ def set_url_map( if compute.SetUrlMapRegionTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py index 693ef242d..c80d2b733 100644 --- a/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/region_target_https_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -235,16 +233,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -325,16 +317,12 @@ def insert( if compute.InsertRegionTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -391,16 +379,10 @@ def list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -487,16 +469,12 @@ def set_ssl_certificates( ): query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -578,16 +556,12 @@ def set_url_map( if compute.SetUrlMapRegionTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/region_url_maps/transports/rest.py b/google/cloud/compute_v1/services/region_url_maps/transports/rest.py index 9ed6579b1..850f767ba 100644 --- a/google/cloud/compute_v1/services/region_url_maps/transports/rest.py +++ b/google/cloud/compute_v1/services/region_url_maps/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -159,16 +163,10 @@ def delete( if compute.DeleteRegionUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -245,16 +243,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -333,16 +325,12 @@ def insert( if compute.InsertRegionUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -394,16 +382,10 @@ def list( if compute.ListRegionUrlMapsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -487,16 +469,12 @@ def patch( if compute.PatchRegionUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -578,16 +556,12 @@ def update( if compute.UpdateRegionUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -639,16 +613,12 @@ def validate( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/regions/transports/rest.py b/google/cloud/compute_v1/services/regions/transports/rest.py index abbaaecf3..b2b35f0ed 100644 --- a/google/cloud/compute_v1/services/regions/transports/rest.py +++ b/google/cloud/compute_v1/services/regions/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -130,16 +134,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -190,16 +188,10 @@ def list( if compute.ListRegionsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/reservations/transports/rest.py b/google/cloud/compute_v1/services/reservations/transports/rest.py index fc1e58093..2da132494 100644 --- a/google/cloud/compute_v1/services/reservations/transports/rest.py +++ b/google/cloud/compute_v1/services/reservations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListReservationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteReservationRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -283,16 +275,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -396,16 +382,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -484,16 +464,12 @@ def insert( if compute.InsertReservationRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -545,16 +521,10 @@ def list( if compute.ListReservationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -638,16 +608,12 @@ def resize( if compute.ResizeReservationRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -749,16 +715,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -810,16 +772,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/resource_policies/transports/rest.py b/google/cloud/compute_v1/services/resource_policies/transports/rest.py index 3160a86ac..70ddd8d50 100644 --- a/google/cloud/compute_v1/services/resource_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/resource_policies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -227,16 +225,10 @@ def delete( if compute.DeleteResourcePolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -287,16 +279,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -400,16 +386,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -488,16 +468,12 @@ def insert( if compute.InsertResourcePolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -549,16 +525,10 @@ def list( if compute.ListResourcePoliciesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -662,16 +632,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -723,16 +689,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/routers/transports/rest.py b/google/cloud/compute_v1/services/routers/transports/rest.py index f8adad2b4..c99d8d566 100644 --- a/google/cloud/compute_v1/services/routers/transports/rest.py +++ b/google/cloud/compute_v1/services/routers/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListRoutersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -223,16 +221,10 @@ def delete( if compute.DeleteRouterRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -279,16 +271,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -345,16 +331,10 @@ def get_nat_mapping_info( if compute.GetNatMappingInfoRoutersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -401,16 +381,10 @@ def get_router_status( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -490,16 +464,12 @@ def insert( if compute.InsertRouterRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -550,16 +520,10 @@ def list( if compute.ListRoutersRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -642,16 +606,12 @@ def patch( if compute.PatchRouterRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -703,16 +663,12 @@ def preview( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -795,16 +751,12 @@ def update( if compute.UpdateRouterRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/routes/transports/rest.py b/google/cloud/compute_v1/services/routes/transports/rest.py index 71d37948d..5cab754e7 100644 --- a/google/cloud/compute_v1/services/routes/transports/rest.py +++ b/google/cloud/compute_v1/services/routes/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -155,16 +159,10 @@ def delete( if compute.DeleteRouteRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -212,16 +210,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -299,16 +291,12 @@ def insert( if compute.InsertRouteRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -359,16 +347,10 @@ def list( if compute.ListRoutesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/security_policies/transports/rest.py b/google/cloud/compute_v1/services/security_policies/transports/rest.py index 6daf2952b..a760203ad 100644 --- a/google/cloud/compute_v1/services/security_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/security_policies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -163,16 +167,12 @@ def add_rule( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -246,16 +246,10 @@ def delete( if compute.DeleteSecurityPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -306,16 +300,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -367,16 +355,10 @@ def get_rule( if compute.GetRuleSecurityPolicyRequest.priority in request: query_params["priority"] = request.priority - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -457,16 +439,12 @@ def insert( if compute.InsertSecurityPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -518,16 +496,10 @@ def list( if compute.ListSecurityPoliciesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -597,16 +569,10 @@ def list_preconfigured_expression_sets( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -689,16 +655,12 @@ def patch( if compute.PatchSecurityPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -779,16 +741,12 @@ def patch_rule( if compute.PatchRuleSecurityPolicyRequest.priority in request: query_params["priority"] = request.priority - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -862,16 +820,10 @@ def remove_rule( if compute.RemoveRuleSecurityPolicyRequest.priority in request: query_params["priority"] = request.priority - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/snapshots/transports/rest.py b/google/cloud/compute_v1/services/snapshots/transports/rest.py index 5262e7b57..b31df569e 100644 --- a/google/cloud/compute_v1/services/snapshots/transports/rest.py +++ b/google/cloud/compute_v1/services/snapshots/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def delete( if compute.DeleteSnapshotRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -212,16 +210,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -320,16 +312,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -382,16 +368,10 @@ def list( if compute.ListSnapshotsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -492,16 +472,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -578,16 +554,12 @@ def set_labels( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -636,16 +608,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/ssl_certificates/transports/rest.py b/google/cloud/compute_v1/services/ssl_certificates/transports/rest.py index 05641956a..b97e2857f 100644 --- a/google/cloud/compute_v1/services/ssl_certificates/transports/rest.py +++ b/google/cloud/compute_v1/services/ssl_certificates/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -226,16 +224,10 @@ def delete( if compute.DeleteSslCertificateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -305,16 +297,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -395,16 +381,12 @@ def insert( if compute.InsertSslCertificateRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -458,16 +440,10 @@ def list( if compute.ListSslCertificatesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/ssl_policies/transports/rest.py b/google/cloud/compute_v1/services/ssl_policies/transports/rest.py index 879c1e41d..7d2a941e6 100644 --- a/google/cloud/compute_v1/services/ssl_policies/transports/rest.py +++ b/google/cloud/compute_v1/services/ssl_policies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -156,16 +160,10 @@ def delete( if compute.DeleteSslPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -214,16 +212,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -302,16 +294,12 @@ def insert( if compute.InsertSslPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -363,16 +351,10 @@ def list( if compute.ListSslPoliciesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -429,16 +411,10 @@ def list_available_features( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -519,16 +495,12 @@ def patch( if compute.PatchSslPolicyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/subnetworks/transports/rest.py b/google/cloud/compute_v1/services/subnetworks/transports/rest.py index da10ad4bd..937372058 100644 --- a/google/cloud/compute_v1/services/subnetworks/transports/rest.py +++ b/google/cloud/compute_v1/services/subnetworks/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListSubnetworksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteSubnetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -315,16 +307,12 @@ def expand_ip_cidr_range( if compute.ExpandIpCidrRangeSubnetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -376,16 +364,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -489,16 +471,10 @@ def get_iam_policy( "optionsRequestedPolicyVersion" ] = request.options_requested_policy_version - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -577,16 +553,12 @@ def insert( if compute.InsertSubnetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -640,16 +612,10 @@ def list( if compute.ListSubnetworksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -703,16 +669,10 @@ def list_usable( if compute.ListUsableSubnetworksRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -798,16 +758,12 @@ def patch( if compute.PatchSubnetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -909,16 +865,12 @@ def set_iam_policy( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1001,16 +953,12 @@ def set_private_ip_google_access( if compute.SetPrivateIpGoogleAccessSubnetworkRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -1062,16 +1010,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_grpc_proxies/transports/rest.py b/google/cloud/compute_v1/services/target_grpc_proxies/transports/rest.py index 8080fea93..a28d8cc55 100644 --- a/google/cloud/compute_v1/services/target_grpc_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/target_grpc_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteTargetGrpcProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -221,16 +219,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -311,16 +303,12 @@ def insert( if compute.InsertTargetGrpcProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -372,16 +360,10 @@ def list( if compute.ListTargetGrpcProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -464,16 +446,12 @@ def patch( if compute.PatchTargetGrpcProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_http_proxies/transports/rest.py b/google/cloud/compute_v1/services/target_http_proxies/transports/rest.py index e25f2db5b..3926b166a 100644 --- a/google/cloud/compute_v1/services/target_http_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/target_http_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -226,16 +224,10 @@ def delete( if compute.DeleteTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -302,16 +294,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -392,16 +378,12 @@ def insert( if compute.InsertTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -453,16 +435,10 @@ def list( if compute.ListTargetHttpProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -545,16 +521,12 @@ def patch( if compute.PatchTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -635,16 +607,12 @@ def set_url_map( if compute.SetUrlMapTargetHttpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_https_proxies/transports/rest.py b/google/cloud/compute_v1/services/target_https_proxies/transports/rest.py index 78323edfc..d247a2884 100644 --- a/google/cloud/compute_v1/services/target_https_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/target_https_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -144,16 +148,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -229,16 +227,10 @@ def delete( if compute.DeleteTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -304,16 +296,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -394,16 +380,12 @@ def insert( if compute.InsertTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -457,16 +439,10 @@ def list( if compute.ListTargetHttpsProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -549,16 +525,12 @@ def patch( if compute.PatchTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -639,16 +611,12 @@ def set_quic_override( if compute.SetQuicOverrideTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -729,16 +697,12 @@ def set_ssl_certificates( if compute.SetSslCertificatesTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -819,16 +783,12 @@ def set_ssl_policy( if compute.SetSslPolicyTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -909,16 +869,12 @@ def set_url_map( if compute.SetUrlMapTargetHttpsProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_instances/transports/rest.py b/google/cloud/compute_v1/services/target_instances/transports/rest.py index fa1ce2cfa..8268725ce 100644 --- a/google/cloud/compute_v1/services/target_instances/transports/rest.py +++ b/google/cloud/compute_v1/services/target_instances/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -227,16 +225,10 @@ def delete( if compute.DeleteTargetInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -289,16 +281,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -379,16 +365,12 @@ def insert( if compute.InsertTargetInstanceRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -442,16 +424,10 @@ def list( if compute.ListTargetInstancesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_pools/transports/rest.py b/google/cloud/compute_v1/services/target_pools/transports/rest.py index a3c4b8576..3aa89f507 100644 --- a/google/cloud/compute_v1/services/target_pools/transports/rest.py +++ b/google/cloud/compute_v1/services/target_pools/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -166,16 +170,12 @@ def add_health_check( if compute.AddHealthCheckTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -257,16 +257,12 @@ def add_instance( if compute.AddInstanceTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -320,16 +316,10 @@ def aggregated_list( if compute.AggregatedListTargetPoolsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -406,16 +396,10 @@ def delete( if compute.DeleteTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -468,16 +452,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -531,16 +509,12 @@ def get_health( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -621,16 +595,12 @@ def insert( if compute.InsertTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -684,16 +654,10 @@ def list( if compute.ListTargetPoolsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -777,16 +741,12 @@ def remove_health_check( if compute.RemoveHealthCheckTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -868,16 +828,12 @@ def remove_instance( if compute.RemoveInstanceTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -961,16 +917,12 @@ def set_backup( if compute.SetBackupTargetPoolRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_ssl_proxies/transports/rest.py b/google/cloud/compute_v1/services/target_ssl_proxies/transports/rest.py index 0353da0ab..8cbd9875a 100644 --- a/google/cloud/compute_v1/services/target_ssl_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/target_ssl_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -219,16 +217,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -309,16 +301,12 @@ def insert( if compute.InsertTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -372,16 +360,10 @@ def list( if compute.ListTargetSslProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -464,16 +446,12 @@ def set_backend_service( if compute.SetBackendServiceTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -554,16 +532,12 @@ def set_proxy_header( if compute.SetProxyHeaderTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -644,16 +618,12 @@ def set_ssl_certificates( if compute.SetSslCertificatesTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -734,16 +704,12 @@ def set_ssl_policy( if compute.SetSslPolicyTargetSslProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_tcp_proxies/transports/rest.py b/google/cloud/compute_v1/services/target_tcp_proxies/transports/rest.py index 6691e2e35..8476f9448 100644 --- a/google/cloud/compute_v1/services/target_tcp_proxies/transports/rest.py +++ b/google/cloud/compute_v1/services/target_tcp_proxies/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -158,16 +162,10 @@ def delete( if compute.DeleteTargetTcpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -219,16 +217,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -309,16 +301,12 @@ def insert( if compute.InsertTargetTcpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -372,16 +360,10 @@ def list( if compute.ListTargetTcpProxiesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -464,16 +446,12 @@ def set_backend_service( if compute.SetBackendServiceTargetTcpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -554,16 +532,12 @@ def set_proxy_header( if compute.SetProxyHeaderTargetTcpProxyRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/target_vpn_gateways/transports/rest.py b/google/cloud/compute_v1/services/target_vpn_gateways/transports/rest.py index a7258cb1b..498677658 100644 --- a/google/cloud/compute_v1/services/target_vpn_gateways/transports/rest.py +++ b/google/cloud/compute_v1/services/target_vpn_gateways/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -141,16 +145,10 @@ def aggregated_list( ): query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -227,16 +225,10 @@ def delete( if compute.DeleteTargetVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -287,16 +279,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -377,16 +363,12 @@ def insert( if compute.InsertTargetVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -440,16 +422,10 @@ def list( if compute.ListTargetVpnGatewaysRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/url_maps/transports/rest.py b/google/cloud/compute_v1/services/url_maps/transports/rest.py index 4b0da7c2e..a186a0105 100644 --- a/google/cloud/compute_v1/services/url_maps/transports/rest.py +++ b/google/cloud/compute_v1/services/url_maps/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListUrlMapsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -220,16 +218,10 @@ def delete( if compute.DeleteUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -302,16 +294,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -389,16 +375,12 @@ def insert( if compute.InsertUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -477,16 +459,12 @@ def invalidate_cache( if compute.InvalidateCacheUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -537,16 +515,10 @@ def list( if compute.ListUrlMapsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -626,16 +598,12 @@ def patch( if compute.PatchUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.patch(url, headers=headers, data=body,) + response = self._session.patch( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -713,16 +681,12 @@ def update( if compute.UpdateUrlMapRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.put(url, headers=headers, data=body,) + response = self._session.put( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -771,16 +735,12 @@ def validate( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/vpn_gateways/transports/rest.py b/google/cloud/compute_v1/services/vpn_gateways/transports/rest.py index a2c2367d2..bd80ef898 100644 --- a/google/cloud/compute_v1/services/vpn_gateways/transports/rest.py +++ b/google/cloud/compute_v1/services/vpn_gateways/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListVpnGatewaysRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -287,16 +279,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -343,16 +329,10 @@ def get_status( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -433,16 +413,12 @@ def insert( if compute.InsertVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -496,16 +472,10 @@ def list( if compute.ListVpnGatewaysRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -589,16 +559,12 @@ def set_labels( if compute.SetLabelsVpnGatewayRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -650,16 +616,12 @@ def test_iam_permissions( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/vpn_tunnels/transports/rest.py b/google/cloud/compute_v1/services/vpn_tunnels/transports/rest.py index ae8cde683..a37cdabe0 100644 --- a/google/cloud/compute_v1/services/vpn_tunnels/transports/rest.py +++ b/google/cloud/compute_v1/services/vpn_tunnels/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -138,16 +142,10 @@ def aggregated_list( if compute.AggregatedListVpnTunnelsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -224,16 +222,10 @@ def delete( if compute.DeleteVpnTunnelRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -281,16 +273,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -369,16 +355,12 @@ def insert( if compute.InsertVpnTunnelRequest.request_id in request: query_params["requestId"] = request.request_id - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers, data=body,) + response = self._session.post( + url, headers=headers, params=query_params, data=body, + ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -432,16 +414,10 @@ def list( if compute.ListVpnTunnelsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/zone_operations/transports/rest.py b/google/cloud/compute_v1/services/zone_operations/transports/rest.py index d156bf23b..fd18f16ab 100644 --- a/google/cloud/compute_v1/services/zone_operations/transports/rest.py +++ b/google/cloud/compute_v1/services/zone_operations/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -132,16 +136,10 @@ def delete( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.delete(url, headers=headers,) + response = self._session.delete(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -216,16 +214,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -279,16 +271,10 @@ def list( if compute.ListZoneOperationsRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -363,16 +349,10 @@ def wait( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.post(url, headers=headers,) + response = self._session.post(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/google/cloud/compute_v1/services/zones/transports/rest.py b/google/cloud/compute_v1/services/zones/transports/rest.py index 955c583f0..c3ad59ff5 100644 --- a/google/cloud/compute_v1/services/zones/transports/rest.py +++ b/google/cloud/compute_v1/services/zones/transports/rest.py @@ -52,6 +52,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -85,7 +86,10 @@ def __init__( # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the # credentials object super().__init__( - host=host, credentials=credentials, client_info=client_info, + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, ) self._session = AuthorizedSession( self._credentials, default_host=self.DEFAULT_HOST @@ -132,16 +136,10 @@ def get( # not required for GCE query_params = {} - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. @@ -192,16 +190,10 @@ def list( if compute.ListZonesRequest.return_partial_success in request: query_params["returnPartialSuccess"] = request.return_partial_success - # TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here - # discards default values - # TODO(yon-mg): add test for proper url encoded strings - query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()] - url += "?{}".format("&".join(query_params)).replace(" ", "+") - # Send the request headers = dict(metadata) headers["Content-Type"] = "application/json" - response = self._session.get(url, headers=headers,) + response = self._session.get(url, headers=headers, params=query_params,) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception # subclass. diff --git a/synth.metadata b/synth.metadata index ada408f96..df26c6680 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,7 +11,7 @@ "git": { "name": "googleapis-discovery", "remote": "https://github.com/googleapis/googleapis-discovery.git", - "sha": "c5bb8d324832f638d86bc1348fb45fb3d9c1fb30" + "sha": "ac663f7f0afb13e3a8cfd04160d1677655c5c613" } } ], diff --git a/tests/unit/gapic/compute_v1/test_accelerator_types.py b/tests/unit/gapic/compute_v1/test_accelerator_types.py index fba4893f4..c9ac506a0 100644 --- a/tests/unit/gapic/compute_v1/test_accelerator_types.py +++ b/tests/unit/gapic/compute_v1/test_accelerator_types.py @@ -118,21 +118,11 @@ def test_accelerator_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [AcceleratorTypesClient,]) -def test_accelerator_types_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.AcceleratorTypesRestTransport, "rest"),], ) -def test_accelerator_types_client_service_account_always_use_jwt_true( +def test_accelerator_types_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_accelerator_types_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [AcceleratorTypesClient,]) def test_accelerator_types_client_from_service_account_file(client_class): @@ -515,7 +512,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -674,9 +672,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "accelerator_type_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "accelerator_type_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -768,8 +767,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_addresses.py b/tests/unit/gapic/compute_v1/test_addresses.py index 55237d3df..1f067fa88 100644 --- a/tests/unit/gapic/compute_v1/test_addresses.py +++ b/tests/unit/gapic/compute_v1/test_addresses.py @@ -112,20 +112,10 @@ def test_addresses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [AddressesClient,]) -def test_addresses_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.AddressesRestTransport, "rest"),] ) -def test_addresses_client_service_account_always_use_jwt_true( +def test_addresses_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_addresses_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [AddressesClient,]) def test_addresses_client_from_service_account_file(client_class): @@ -486,7 +483,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -669,9 +667,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "address_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "address_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -779,9 +778,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "address_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "address_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -910,13 +910,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Address.to_json( address_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1002,8 +1003,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_autoscalers.py b/tests/unit/gapic/compute_v1/test_autoscalers.py index b0f5b9627..ec7777b4f 100644 --- a/tests/unit/gapic/compute_v1/test_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_autoscalers.py @@ -114,20 +114,10 @@ def test_autoscalers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [AutoscalersClient,]) -def test_autoscalers_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.AutoscalersRestTransport, "rest"),] ) -def test_autoscalers_client_service_account_always_use_jwt_true( +def test_autoscalers_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_autoscalers_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [AutoscalersClient,]) def test_autoscalers_client_from_service_account_file(client_class): @@ -502,7 +499,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -688,9 +686,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "autoscaler_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "autoscaler_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -804,9 +803,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "autoscaler_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "autoscaler_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -937,13 +937,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1043,8 +1044,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1222,13 +1224,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1361,13 +1364,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_backend_buckets.py b/tests/unit/gapic/compute_v1/test_backend_buckets.py index 36c758405..520af50d5 100644 --- a/tests/unit/gapic/compute_v1/test_backend_buckets.py +++ b/tests/unit/gapic/compute_v1/test_backend_buckets.py @@ -117,21 +117,11 @@ def test_backend_buckets_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [BackendBucketsClient,]) -def test_backend_buckets_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.BackendBucketsRestTransport, "rest"),], ) -def test_backend_buckets_client_service_account_always_use_jwt_true( +def test_backend_buckets_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_backend_buckets_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [BackendBucketsClient,]) def test_backend_buckets_client_from_service_account_file(client_class): @@ -531,13 +528,14 @@ def test_add_signed_url_key_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) assert compute.SignedUrlKey.to_json( signed_url_key_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_signed_url_key_rest_flattened_error(): @@ -663,8 +661,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -791,9 +790,10 @@ def test_delete_signed_url_key_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) - assert "key_name_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) + assert "key_name_value" in http_call[1] + str(body) + str(params) def test_delete_signed_url_key_rest_flattened_error(): @@ -901,8 +901,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1028,12 +1029,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.BackendBucket.to_json( backend_bucket_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1120,7 +1122,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1294,13 +1297,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) assert compute.BackendBucket.to_json( backend_bucket_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1431,13 +1435,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_bucket_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_bucket_value" in http_call[1] + str(body) + str(params) assert compute.BackendBucket.to_json( backend_bucket_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_backend_services.py b/tests/unit/gapic/compute_v1/test_backend_services.py index 52f51495d..8e840ddc6 100644 --- a/tests/unit/gapic/compute_v1/test_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_backend_services.py @@ -117,21 +117,11 @@ def test_backend_services_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [BackendServicesClient,]) -def test_backend_services_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.BackendServicesRestTransport, "rest"),], ) -def test_backend_services_client_service_account_always_use_jwt_true( +def test_backend_services_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_backend_services_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [BackendServicesClient,]) def test_backend_services_client_from_service_account_file(client_class): @@ -541,13 +538,14 @@ def test_add_signed_url_key_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.SignedUrlKey.to_json( signed_url_key_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_signed_url_key_rest_flattened_error(): @@ -645,7 +643,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -834,8 +833,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -963,9 +963,10 @@ def test_delete_signed_url_key_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) - assert "key_name_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) + assert "key_name_value" in http_call[1] + str(body) + str(params) def test_delete_signed_url_key_rest_flattened_error(): @@ -1151,8 +1152,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1242,13 +1244,14 @@ def test_get_health_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.ResourceGroupReference.to_json( resource_group_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_get_health_rest_flattened_error(): @@ -1377,12 +1380,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1469,7 +1473,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1643,13 +1648,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1782,13 +1788,14 @@ def test_set_security_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.SecurityPolicyReference.to_json( security_policy_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_security_policy_rest_flattened_error(): @@ -1919,13 +1926,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_disk_types.py b/tests/unit/gapic/compute_v1/test_disk_types.py index c45d542db..f4277f95a 100644 --- a/tests/unit/gapic/compute_v1/test_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_disk_types.py @@ -112,20 +112,10 @@ def test_disk_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [DiskTypesClient,]) -def test_disk_types_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.DiskTypesRestTransport, "rest"),] ) -def test_disk_types_client_service_account_always_use_jwt_true( +def test_disk_types_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_disk_types_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [DiskTypesClient,]) def test_disk_types_client_from_service_account_file(client_class): @@ -490,7 +487,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -643,9 +641,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_type_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_type_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -733,8 +732,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_disks.py b/tests/unit/gapic/compute_v1/test_disks.py index e2ffd150d..bdd1b5b08 100644 --- a/tests/unit/gapic/compute_v1/test_disks.py +++ b/tests/unit/gapic/compute_v1/test_disks.py @@ -109,22 +109,10 @@ def test_disks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [DisksClient,]) -def test_disks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.DisksRestTransport, "rest"),] ) -def test_disks_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_disks_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -132,6 +120,13 @@ def test_disks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [DisksClient,]) def test_disks_client_from_service_account_file(client_class): @@ -519,14 +514,15 @@ def test_add_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.DisksAddResourcePoliciesRequest.to_json( disks_add_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_resource_policies_rest_flattened_error(): @@ -625,7 +621,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -809,14 +806,15 @@ def test_create_snapshot_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.Snapshot.to_json( snapshot_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_create_snapshot_rest_flattened_error(): @@ -941,9 +939,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1109,9 +1108,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1213,9 +1213,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1340,13 +1341,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Disk.to_json( disk_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1434,8 +1436,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1604,14 +1607,15 @@ def test_remove_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.DisksRemoveResourcePoliciesRequest.to_json( disks_remove_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_resource_policies_rest_flattened_error(): @@ -1742,14 +1746,15 @@ def test_resize_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.DisksResizeRequest.to_json( disks_resize_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_resize_rest_flattened_error(): @@ -1858,14 +1863,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.ZoneSetPolicyRequest.to_json( zone_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -2000,14 +2006,15 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.ZoneSetLabelsRequest.to_json( zone_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -2094,14 +2101,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py index 7263e0149..e34bb5d77 100644 --- a/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_external_vpn_gateways.py @@ -120,21 +120,11 @@ def test_external_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ExternalVpnGatewaysClient,]) -def test_external_vpn_gateways_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ExternalVpnGatewaysRestTransport, "rest"),], ) -def test_external_vpn_gateways_client_service_account_always_use_jwt_true( +def test_external_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_external_vpn_gateways_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ExternalVpnGatewaysClient,]) def test_external_vpn_gateways_client_from_service_account_file(client_class): @@ -543,8 +540,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "external_vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "external_vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -646,8 +644,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "external_vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "external_vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -780,12 +779,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ExternalVpnGateway.to_json( external_vpn_gateway_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -884,7 +884,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1066,13 +1067,14 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetLabelsRequest.to_json( global_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1162,13 +1164,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_firewall_policies.py b/tests/unit/gapic/compute_v1/test_firewall_policies.py index e1df9a395..afe59eb65 100644 --- a/tests/unit/gapic/compute_v1/test_firewall_policies.py +++ b/tests/unit/gapic/compute_v1/test_firewall_policies.py @@ -118,21 +118,11 @@ def test_firewall_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [FirewallPoliciesClient,]) -def test_firewall_policies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.FirewallPoliciesRestTransport, "rest"),], ) -def test_firewall_policies_client_service_account_always_use_jwt_true( +def test_firewall_policies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_firewall_policies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [FirewallPoliciesClient,]) def test_firewall_policies_client_from_service_account_file(client_class): @@ -543,12 +540,13 @@ def test_add_association_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) assert compute.FirewallPolicyAssociation.to_json( firewall_policy_association_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_association_rest_flattened_error(): @@ -679,12 +677,13 @@ def test_add_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) assert compute.FirewallPolicyRule.to_json( firewall_policy_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_rule_rest_flattened_error(): @@ -809,7 +808,8 @@ def test_clone_rules_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_clone_rules_rest_flattened_error(): @@ -931,7 +931,8 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1037,7 +1038,8 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1118,7 +1120,8 @@ def test_get_association_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_get_association_rest_flattened_error(): @@ -1216,7 +1219,8 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1313,7 +1317,8 @@ def test_get_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_get_rule_rest_flattened_error(): @@ -1442,11 +1447,12 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") + params = http_params.get("params") assert compute.FirewallPolicy.to_json( firewall_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1550,6 +1556,7 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") + params = http_params.get("params") def test_list_rest_flattened_error(): @@ -1680,6 +1687,7 @@ def test_list_associations_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") + params = http_params.get("params") def test_list_associations_rest_flattened_error(): @@ -1798,7 +1806,8 @@ def test_move_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_move_rest_flattened_error(): @@ -1930,12 +1939,13 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) assert compute.FirewallPolicy.to_json( firewall_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -2070,12 +2080,13 @@ def test_patch_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) assert compute.FirewallPolicyRule.to_json( firewall_policy_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rule_rest_flattened_error(): @@ -2200,7 +2211,8 @@ def test_remove_association_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_remove_association_rest_flattened_error(): @@ -2322,7 +2334,8 @@ def test_remove_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "firewall_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "firewall_policy_value" in http_call[1] + str(body) + str(params) def test_remove_rule_rest_flattened_error(): @@ -2426,12 +2439,13 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalOrganizationSetPolicyRequest.to_json( global_organization_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -2515,12 +2529,13 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_firewalls.py b/tests/unit/gapic/compute_v1/test_firewalls.py index 60d80b867..6bfd4fd66 100644 --- a/tests/unit/gapic/compute_v1/test_firewalls.py +++ b/tests/unit/gapic/compute_v1/test_firewalls.py @@ -112,20 +112,10 @@ def test_firewalls_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [FirewallsClient,]) -def test_firewalls_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.FirewallsRestTransport, "rest"),] ) -def test_firewalls_client_service_account_always_use_jwt_true( +def test_firewalls_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_firewalls_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [FirewallsClient,]) def test_firewalls_client_from_service_account_file(client_class): @@ -516,8 +513,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "firewall_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "firewall_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -628,8 +626,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "firewall_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "firewall_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -757,12 +756,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Firewall.to_json( firewall_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -853,7 +853,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1019,13 +1020,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "firewall_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "firewall_value" in http_call[1] + str(body) + str(params) assert compute.Firewall.to_json( firewall_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1158,13 +1160,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "firewall_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "firewall_value" in http_call[1] + str(body) + str(params) assert compute.Firewall.to_json( firewall_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_forwarding_rules.py index 3ff331a48..26e15180b 100644 --- a/tests/unit/gapic/compute_v1/test_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_forwarding_rules.py @@ -117,21 +117,11 @@ def test_forwarding_rules_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ForwardingRulesClient,]) -def test_forwarding_rules_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ForwardingRulesRestTransport, "rest"),], ) -def test_forwarding_rules_client_service_account_always_use_jwt_true( +def test_forwarding_rules_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_forwarding_rules_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ForwardingRulesClient,]) def test_forwarding_rules_client_from_service_account_file(client_class): @@ -510,7 +507,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -701,9 +699,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -856,9 +855,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -989,13 +989,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.ForwardingRule.to_json( forwarding_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1085,8 +1086,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1265,14 +1267,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) assert compute.ForwardingRule.to_json( forwarding_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1407,14 +1410,15 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetLabelsRequest.to_json( region_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1547,14 +1551,15 @@ def test_set_target_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) assert compute.TargetReference.to_json( target_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_target_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_addresses.py b/tests/unit/gapic/compute_v1/test_global_addresses.py index f20e82e75..35f92ad4a 100644 --- a/tests/unit/gapic/compute_v1/test_global_addresses.py +++ b/tests/unit/gapic/compute_v1/test_global_addresses.py @@ -117,21 +117,11 @@ def test_global_addresses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalAddressesClient,]) -def test_global_addresses_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalAddressesRestTransport, "rest"),], ) -def test_global_addresses_client_service_account_always_use_jwt_true( +def test_global_addresses_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_global_addresses_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalAddressesClient,]) def test_global_addresses_client_from_service_account_file(client_class): @@ -538,8 +535,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "address_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "address_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -648,8 +646,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "address_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "address_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -775,12 +774,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Address.to_json( address_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -865,7 +865,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py index 1e6dc4852..87f819ca5 100644 --- a/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py +++ b/tests/unit/gapic/compute_v1/test_global_forwarding_rules.py @@ -120,21 +120,11 @@ def test_global_forwarding_rules_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalForwardingRulesClient,]) -def test_global_forwarding_rules_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalForwardingRulesRestTransport, "rest"),], ) -def test_global_forwarding_rules_client_service_account_always_use_jwt_true( +def test_global_forwarding_rules_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_global_forwarding_rules_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalForwardingRulesClient,]) def test_global_forwarding_rules_client_from_service_account_file(client_class): @@ -561,8 +558,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -716,8 +714,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -849,12 +848,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ForwardingRule.to_json( forwarding_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -945,7 +945,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1127,13 +1128,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) assert compute.ForwardingRule.to_json( forwarding_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1270,13 +1272,14 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetLabelsRequest.to_json( global_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1411,13 +1414,14 @@ def test_set_target_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "forwarding_rule_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "forwarding_rule_value" in http_call[1] + str(body) + str(params) assert compute.TargetReference.to_json( target_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_target_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py index 7fbc42ae8..833f6fbac 100644 --- a/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_global_network_endpoint_groups.py @@ -122,23 +122,11 @@ def test_global_network_endpoint_groups_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalNetworkEndpointGroupsClient,]) -def test_global_network_endpoint_groups_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalNetworkEndpointGroupsRestTransport, "rest"),], ) -def test_global_network_endpoint_groups_client_service_account_always_use_jwt_true( +def test_global_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_global_network_endpoint_groups_client_service_account_always_use_jwt_tr transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalNetworkEndpointGroupsClient,]) def test_global_network_endpoint_groups_client_from_service_account_file(client_class): @@ -577,13 +572,14 @@ def test_attach_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) assert compute.GlobalNetworkEndpointGroupsAttachEndpointsRequest.to_json( global_network_endpoint_groups_attach_endpoints_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_attach_network_endpoints_rest_flattened_error(): @@ -719,8 +715,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -857,13 +854,14 @@ def test_detach_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) assert compute.GlobalNetworkEndpointGroupsDetachEndpointsRequest.to_json( global_network_endpoint_groups_detach_endpoints_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_detach_network_endpoints_rest_flattened_error(): @@ -993,8 +991,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1128,12 +1127,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroup.to_json( network_endpoint_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1228,7 +1228,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1391,8 +1392,9 @@ def test_list_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_list_network_endpoints_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_operations.py b/tests/unit/gapic/compute_v1/test_global_operations.py index a8e56b8aa..6141295c6 100644 --- a/tests/unit/gapic/compute_v1/test_global_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_operations.py @@ -118,21 +118,11 @@ def test_global_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalOperationsClient,]) -def test_global_operations_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalOperationsRestTransport, "rest"),], ) -def test_global_operations_client_service_account_always_use_jwt_true( +def test_global_operations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_global_operations_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalOperationsClient,]) def test_global_operations_client_from_service_account_file(client_class): @@ -515,7 +512,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -647,8 +645,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -773,8 +772,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -861,7 +861,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1024,8 +1025,9 @@ def test_wait_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_wait_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_organization_operations.py b/tests/unit/gapic/compute_v1/test_global_organization_operations.py index b766a1830..1cc609c3e 100644 --- a/tests/unit/gapic/compute_v1/test_global_organization_operations.py +++ b/tests/unit/gapic/compute_v1/test_global_organization_operations.py @@ -122,23 +122,11 @@ def test_global_organization_operations_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalOrganizationOperationsClient,]) -def test_global_organization_operations_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalOrganizationOperationsRestTransport, "rest"),], ) -def test_global_organization_operations_client_service_account_always_use_jwt_true( +def test_global_organization_operations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_global_organization_operations_client_service_account_always_use_jwt_tr transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalOrganizationOperationsClient,]) def test_global_organization_operations_client_from_service_account_file(client_class): @@ -521,7 +516,8 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "operation_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -647,7 +643,8 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "operation_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -738,6 +735,7 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") + params = http_params.get("params") def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py index 9d6ed1edf..ea04a4812 100644 --- a/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py @@ -126,23 +126,11 @@ def test_global_public_delegated_prefixes_client_from_service_account_info( assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [GlobalPublicDelegatedPrefixesClient,]) -def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.GlobalPublicDelegatedPrefixesRestTransport, "rest"),], ) -def test_global_public_delegated_prefixes_client_service_account_always_use_jwt_true( +def test_global_public_delegated_prefixes_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -152,6 +140,13 @@ def test_global_public_delegated_prefixes_client_service_account_always_use_jwt_ transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [GlobalPublicDelegatedPrefixesClient,]) def test_global_public_delegated_prefixes_client_from_service_account_file( @@ -577,8 +572,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -692,8 +688,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -827,12 +824,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.PublicDelegatedPrefix.to_json( public_delegated_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -930,7 +928,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1116,13 +1115,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) assert compute.PublicDelegatedPrefix.to_json( public_delegated_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_health_checks.py b/tests/unit/gapic/compute_v1/test_health_checks.py index 3b650dcdf..99c41f498 100644 --- a/tests/unit/gapic/compute_v1/test_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_health_checks.py @@ -114,20 +114,10 @@ def test_health_checks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [HealthChecksClient,]) -def test_health_checks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.HealthChecksRestTransport, "rest"),] ) -def test_health_checks_client_service_account_always_use_jwt_true( +def test_health_checks_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_health_checks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [HealthChecksClient,]) def test_health_checks_client_from_service_account_file(client_class): @@ -490,7 +487,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -678,8 +676,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -794,8 +793,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -921,12 +921,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1011,7 +1012,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1185,13 +1187,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1320,13 +1323,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_images.py b/tests/unit/gapic/compute_v1/test_images.py index 90e6c161a..11e00a377 100644 --- a/tests/unit/gapic/compute_v1/test_images.py +++ b/tests/unit/gapic/compute_v1/test_images.py @@ -109,22 +109,10 @@ def test_images_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ImagesClient,]) -def test_images_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ImagesRestTransport, "rest"),] ) -def test_images_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_images_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -132,6 +120,13 @@ def test_images_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ImagesClient,]) def test_images_client_from_service_account_file(client_class): @@ -511,8 +506,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "image_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "image_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -638,13 +634,14 @@ def test_deprecate_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "image_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "image_value" in http_call[1] + str(body) + str(params) assert compute.DeprecationStatus.to_json( deprecation_status_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_deprecate_rest_flattened_error(): @@ -812,8 +809,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "image_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "image_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -978,8 +976,9 @@ def test_get_from_family_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "family_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "family_value" in http_call[1] + str(body) + str(params) def test_get_from_family_rest_flattened_error(): @@ -1080,8 +1079,9 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1205,12 +1205,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Image.to_json( image_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1293,7 +1294,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1455,13 +1457,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "image_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "image_value" in http_call[1] + str(body) + str(params) assert compute.Image.to_json( image_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1568,13 +1571,14 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetPolicyRequest.to_json( global_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1707,13 +1711,14 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetLabelsRequest.to_json( global_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1798,13 +1803,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_instance_group_managers.py index 3f37da126..d9660c0e9 100644 --- a/tests/unit/gapic/compute_v1/test_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_instance_group_managers.py @@ -120,21 +120,11 @@ def test_instance_group_managers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InstanceGroupManagersClient,]) -def test_instance_group_managers_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InstanceGroupManagersRestTransport, "rest"),], ) -def test_instance_group_managers_client_service_account_always_use_jwt_true( +def test_instance_group_managers_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_instance_group_managers_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InstanceGroupManagersClient,]) def test_instance_group_managers_client_from_service_account_file(client_class): @@ -568,14 +565,15 @@ def test_abandon_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersAbandonInstancesRequest.to_json( instance_group_managers_abandon_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_abandon_instances_rest_flattened_error(): @@ -699,7 +697,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -904,14 +903,15 @@ def test_apply_updates_to_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersApplyUpdatesRequest.to_json( instance_group_managers_apply_updates_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_apply_updates_to_instances_rest_flattened_error(): @@ -1051,14 +1051,15 @@ def test_create_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersCreateInstancesRequest.to_json( instance_group_managers_create_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_create_instances_rest_flattened_error(): @@ -1193,9 +1194,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1332,14 +1334,15 @@ def test_delete_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersDeleteInstancesRequest.to_json( instance_group_managers_delete_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_delete_instances_rest_flattened_error(): @@ -1479,14 +1482,15 @@ def test_delete_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersDeletePerInstanceConfigsReq.to_json( instance_group_managers_delete_per_instance_configs_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_delete_per_instance_configs_rest_flattened_error(): @@ -1655,9 +1659,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1796,13 +1801,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManager.to_json( instance_group_manager_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1916,8 +1922,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -2068,9 +2075,10 @@ def test_list_errors_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_errors_rest_flattened_error(): @@ -2226,9 +2234,10 @@ def test_list_managed_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_managed_instances_rest_flattened_error(): @@ -2381,9 +2390,10 @@ def test_list_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_per_instance_configs_rest_flattened_error(): @@ -2578,14 +2588,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManager.to_json( instance_group_manager_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -2731,14 +2742,15 @@ def test_patch_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersPatchPerInstanceConfigsReq.to_json( instance_group_managers_patch_per_instance_configs_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_per_instance_configs_rest_flattened_error(): @@ -2880,14 +2892,15 @@ def test_recreate_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersRecreateInstancesRequest.to_json( instance_group_managers_recreate_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_recreate_instances_rest_flattened_error(): @@ -3023,10 +3036,11 @@ def test_resize_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) - assert str(443) in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) + assert str(443) in http_call[1] + str(body) + str(params) def test_resize_rest_flattened_error(): @@ -3164,14 +3178,15 @@ def test_set_instance_template_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersSetInstanceTemplateRequest.to_json( instance_group_managers_set_instance_template_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_instance_template_rest_flattened_error(): @@ -3311,14 +3326,15 @@ def test_set_target_pools_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersSetTargetPoolsRequest.to_json( instance_group_managers_set_target_pools_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_target_pools_rest_flattened_error(): @@ -3460,14 +3476,15 @@ def test_update_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManagersUpdatePerInstanceConfigsReq.to_json( instance_group_managers_update_per_instance_configs_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_per_instance_configs_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_instance_groups.py b/tests/unit/gapic/compute_v1/test_instance_groups.py index 2f41794b5..4f645f482 100644 --- a/tests/unit/gapic/compute_v1/test_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_instance_groups.py @@ -117,21 +117,11 @@ def test_instance_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InstanceGroupsClient,]) -def test_instance_groups_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InstanceGroupsRestTransport, "rest"),], ) -def test_instance_groups_client_service_account_always_use_jwt_true( +def test_instance_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_instance_groups_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InstanceGroupsClient,]) def test_instance_groups_client_from_service_account_file(client_class): @@ -534,14 +531,15 @@ def test_add_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupsAddInstancesRequest.to_json( instance_groups_add_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_instances_rest_flattened_error(): @@ -646,7 +644,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -836,9 +835,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -942,9 +942,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1075,13 +1076,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroup.to_json( instance_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1175,8 +1177,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1317,14 +1320,15 @@ def test_list_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupsListInstancesRequest.to_json( instance_groups_list_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_list_instances_rest_flattened_error(): @@ -1512,14 +1516,15 @@ def test_remove_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupsRemoveInstancesRequest.to_json( instance_groups_remove_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_instances_rest_flattened_error(): @@ -1654,14 +1659,15 @@ def test_set_named_ports_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupsSetNamedPortsRequest.to_json( instance_groups_set_named_ports_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_named_ports_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_instance_templates.py b/tests/unit/gapic/compute_v1/test_instance_templates.py index f1c957eec..aa93172ef 100644 --- a/tests/unit/gapic/compute_v1/test_instance_templates.py +++ b/tests/unit/gapic/compute_v1/test_instance_templates.py @@ -118,21 +118,11 @@ def test_instance_templates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InstanceTemplatesClient,]) -def test_instance_templates_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InstanceTemplatesRestTransport, "rest"),], ) -def test_instance_templates_client_service_account_always_use_jwt_true( +def test_instance_templates_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_instance_templates_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InstanceTemplatesClient,]) def test_instance_templates_client_from_service_account_file(client_class): @@ -539,8 +536,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "instance_template_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "instance_template_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -645,8 +643,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "instance_template_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "instance_template_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -747,8 +746,9 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -877,12 +877,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.InstanceTemplate.to_json( instance_template_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -973,7 +974,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1125,13 +1127,14 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetPolicyRequest.to_json( global_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1217,13 +1220,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_instances.py b/tests/unit/gapic/compute_v1/test_instances.py index a8d0c3c42..a4930d907 100644 --- a/tests/unit/gapic/compute_v1/test_instances.py +++ b/tests/unit/gapic/compute_v1/test_instances.py @@ -112,20 +112,10 @@ def test_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InstancesClient,]) -def test_instances_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InstancesRestTransport, "rest"),] ) -def test_instances_client_service_account_always_use_jwt_true( +def test_instances_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_instances_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InstancesClient,]) def test_instances_client_from_service_account_file(client_class): @@ -521,15 +518,16 @@ def test_add_access_config_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "network_interface_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "network_interface_value" in http_call[1] + str(body) + str(params) assert compute.AccessConfig.to_json( access_config_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_access_config_rest_flattened_error(): @@ -663,14 +661,15 @@ def test_add_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesAddResourcePoliciesRequest.to_json( instances_add_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_resource_policies_rest_flattened_error(): @@ -781,7 +780,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -968,14 +968,15 @@ def test_attach_disk_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.AttachedDisk.to_json( attached_disk_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_attach_disk_rest_flattened_error(): @@ -1107,13 +1108,14 @@ def test_bulk_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.BulkInsertInstanceResource.to_json( bulk_insert_instance_resource_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_bulk_insert_rest_flattened_error(): @@ -1241,9 +1243,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1373,11 +1376,12 @@ def test_delete_access_config_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "access_config_value" in http_call[1] + str(body) - assert "network_interface_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "access_config_value" in http_call[1] + str(body) + str(params) + assert "network_interface_value" in http_call[1] + str(body) + str(params) def test_delete_access_config_rest_flattened_error(): @@ -1508,10 +1512,11 @@ def test_detach_disk_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "device_name_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "device_name_value" in http_call[1] + str(body) + str(params) def test_detach_disk_rest_flattened_error(): @@ -1696,9 +1701,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1799,10 +1805,11 @@ def test_get_effective_firewalls_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "network_interface_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "network_interface_value" in http_call[1] + str(body) + str(params) def test_get_effective_firewalls_rest_flattened_error(): @@ -1895,9 +1902,10 @@ def test_get_guest_attributes_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_get_guest_attributes_rest_flattened_error(): @@ -1999,9 +2007,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -2078,9 +2087,10 @@ def test_get_screenshot_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_get_screenshot_rest_flattened_error(): @@ -2166,9 +2176,10 @@ def test_get_serial_port_output_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_get_serial_port_output_rest_flattened_error(): @@ -2257,9 +2268,10 @@ def test_get_shielded_instance_identity_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_get_shielded_instance_identity_rest_flattened_error(): @@ -2392,13 +2404,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Instance.to_json( instance_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -2500,8 +2513,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -2626,9 +2640,10 @@ def test_list_referrers_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_list_referrers_rest_flattened_error(): @@ -2804,14 +2819,15 @@ def test_remove_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesRemoveResourcePoliciesRequest.to_json( instances_remove_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_resource_policies_rest_flattened_error(): @@ -2938,9 +2954,10 @@ def test_reset_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_reset_rest_flattened_error(): @@ -3066,9 +3083,10 @@ def test_set_deletion_protection_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_set_deletion_protection_rest_flattened_error(): @@ -3198,11 +3216,12 @@ def test_set_disk_auto_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert str(True) in http_call[1] + str(body) - assert "device_name_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert str(True) in http_call[1] + str(body) + str(params) + assert "device_name_value" in http_call[1] + str(body) + str(params) def test_set_disk_auto_delete_rest_flattened_error(): @@ -3312,14 +3331,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.ZoneSetPolicyRequest.to_json( zone_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -3454,14 +3474,15 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesSetLabelsRequest.to_json( instances_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -3596,14 +3617,15 @@ def test_set_machine_resources_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesSetMachineResourcesRequest.to_json( instances_set_machine_resources_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_machine_resources_rest_flattened_error(): @@ -3738,14 +3760,15 @@ def test_set_machine_type_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesSetMachineTypeRequest.to_json( instances_set_machine_type_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_machine_type_rest_flattened_error(): @@ -3878,14 +3901,15 @@ def test_set_metadata_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.Metadata.to_json( metadata_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_metadata_rest_flattened_error(): @@ -4018,14 +4042,15 @@ def test_set_min_cpu_platform_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesSetMinCpuPlatformRequest.to_json( instances_set_min_cpu_platform_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_min_cpu_platform_rest_flattened_error(): @@ -4158,14 +4183,15 @@ def test_set_scheduling_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.Scheduling.to_json( scheduling_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_scheduling_rest_flattened_error(): @@ -4298,14 +4324,15 @@ def test_set_service_account_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesSetServiceAccountRequest.to_json( instances_set_service_account_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_service_account_rest_flattened_error(): @@ -4441,14 +4468,15 @@ def test_set_shielded_instance_integrity_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.ShieldedInstanceIntegrityPolicy.to_json( shielded_instance_integrity_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_shielded_instance_integrity_policy_rest_flattened_error(): @@ -4581,14 +4609,15 @@ def test_set_tags_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.Tags.to_json( tags_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_tags_rest_flattened_error(): @@ -4716,9 +4745,10 @@ def test_simulate_maintenance_event_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_simulate_maintenance_event_rest_flattened_error(): @@ -4842,9 +4872,10 @@ def test_start_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_start_rest_flattened_error(): @@ -4982,14 +5013,15 @@ def test_start_with_encryption_key_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.InstancesStartWithEncryptionKeyRequest.to_json( instances_start_with_encryption_key_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_start_with_encryption_key_rest_flattened_error(): @@ -5122,9 +5154,10 @@ def test_stop_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) def test_stop_rest_flattened_error(): @@ -5208,14 +5241,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): @@ -5352,14 +5386,15 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.Instance.to_json( instance_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): @@ -5495,15 +5530,16 @@ def test_update_access_config_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "network_interface_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "network_interface_value" in http_call[1] + str(body) + str(params) assert compute.AccessConfig.to_json( access_config_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_access_config_rest_flattened_error(): @@ -5635,14 +5671,15 @@ def test_update_display_device_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.DisplayDevice.to_json( display_device_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_display_device_rest_flattened_error(): @@ -5776,15 +5813,16 @@ def test_update_network_interface_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) - assert "network_interface_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) + assert "network_interface_value" in http_call[1] + str(body) + str(params) assert compute.NetworkInterface.to_json( network_interface_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_network_interface_rest_flattened_error(): @@ -5921,14 +5959,15 @@ def test_update_shielded_instance_config_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "instance_value" in http_call[1] + str(body) + str(params) assert compute.ShieldedInstanceConfig.to_json( shielded_instance_config_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_shielded_instance_config_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py index 1eaa5f3a6..f325c86cc 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_attachments.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_attachments.py @@ -120,21 +120,11 @@ def test_interconnect_attachments_client_from_service_account_info(client_class) assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InterconnectAttachmentsClient,]) -def test_interconnect_attachments_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InterconnectAttachmentsRestTransport, "rest"),], ) -def test_interconnect_attachments_client_service_account_always_use_jwt_true( +def test_interconnect_attachments_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_interconnect_attachments_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InterconnectAttachmentsClient,]) def test_interconnect_attachments_client_from_service_account_file(client_class): @@ -540,7 +537,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -740,9 +738,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "interconnect_attachment_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "interconnect_attachment_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -895,9 +894,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "interconnect_attachment_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "interconnect_attachment_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1032,13 +1032,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.InterconnectAttachment.to_json( interconnect_attachment_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1132,8 +1133,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1323,14 +1325,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "interconnect_attachment_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "interconnect_attachment_value" in http_call[1] + str(body) + str(params) assert compute.InterconnectAttachment.to_json( interconnect_attachment_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_interconnect_locations.py b/tests/unit/gapic/compute_v1/test_interconnect_locations.py index 1dd797a60..7312bc97b 100644 --- a/tests/unit/gapic/compute_v1/test_interconnect_locations.py +++ b/tests/unit/gapic/compute_v1/test_interconnect_locations.py @@ -120,21 +120,11 @@ def test_interconnect_locations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InterconnectLocationsClient,]) -def test_interconnect_locations_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InterconnectLocationsRestTransport, "rest"),], ) -def test_interconnect_locations_client_service_account_always_use_jwt_true( +def test_interconnect_locations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_interconnect_locations_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InterconnectLocationsClient,]) def test_interconnect_locations_client_from_service_account_file(client_class): @@ -546,8 +543,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "interconnect_location_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "interconnect_location_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -636,7 +634,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_interconnects.py b/tests/unit/gapic/compute_v1/test_interconnects.py index 04421e416..e26bf7831 100644 --- a/tests/unit/gapic/compute_v1/test_interconnects.py +++ b/tests/unit/gapic/compute_v1/test_interconnects.py @@ -117,20 +117,10 @@ def test_interconnects_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [InterconnectsClient,]) -def test_interconnects_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.InterconnectsRestTransport, "rest"),] ) -def test_interconnects_client_service_account_always_use_jwt_true( +def test_interconnects_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -140,6 +130,13 @@ def test_interconnects_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [InterconnectsClient,]) def test_interconnects_client_from_service_account_file(client_class): @@ -527,8 +524,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "interconnect_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "interconnect_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -663,8 +661,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "interconnect_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "interconnect_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -755,8 +754,9 @@ def test_get_diagnostics_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "interconnect_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "interconnect_value" in http_call[1] + str(body) + str(params) def test_get_diagnostics_rest_flattened_error(): @@ -882,12 +882,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Interconnect.to_json( interconnect_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -972,7 +973,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1146,13 +1148,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "interconnect_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "interconnect_value" in http_call[1] + str(body) + str(params) assert compute.Interconnect.to_json( interconnect_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_license_codes.py b/tests/unit/gapic/compute_v1/test_license_codes.py index 06804cff5..99d81a433 100644 --- a/tests/unit/gapic/compute_v1/test_license_codes.py +++ b/tests/unit/gapic/compute_v1/test_license_codes.py @@ -113,20 +113,10 @@ def test_license_codes_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [LicenseCodesClient,]) -def test_license_codes_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.LicenseCodesRestTransport, "rest"),] ) -def test_license_codes_client_service_account_always_use_jwt_true( +def test_license_codes_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -136,6 +126,13 @@ def test_license_codes_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [LicenseCodesClient,]) def test_license_codes_client_from_service_account_file(client_class): @@ -489,8 +486,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "license_code_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "license_code_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -572,13 +570,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_licenses.py b/tests/unit/gapic/compute_v1/test_licenses.py index d488414ff..cca708c67 100644 --- a/tests/unit/gapic/compute_v1/test_licenses.py +++ b/tests/unit/gapic/compute_v1/test_licenses.py @@ -112,20 +112,10 @@ def test_licenses_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [LicensesClient,]) -def test_licenses_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.LicensesRestTransport, "rest"),] ) -def test_licenses_client_service_account_always_use_jwt_true( +def test_licenses_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_licenses_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [LicensesClient,]) def test_licenses_client_from_service_account_file(client_class): @@ -516,8 +513,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "license__value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "license__value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -614,8 +612,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "license__value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "license__value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -716,8 +715,9 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -843,12 +843,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.License.to_json( license_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -929,7 +930,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1077,13 +1079,14 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetPolicyRequest.to_json( global_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1168,13 +1171,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_machine_types.py b/tests/unit/gapic/compute_v1/test_machine_types.py index a473b5a0b..40e2f7fbd 100644 --- a/tests/unit/gapic/compute_v1/test_machine_types.py +++ b/tests/unit/gapic/compute_v1/test_machine_types.py @@ -114,20 +114,10 @@ def test_machine_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [MachineTypesClient,]) -def test_machine_types_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.MachineTypesRestTransport, "rest"),] ) -def test_machine_types_client_service_account_always_use_jwt_true( +def test_machine_types_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_machine_types_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [MachineTypesClient,]) def test_machine_types_client_from_service_account_file(client_class): @@ -500,7 +497,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -668,9 +666,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "machine_type_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "machine_type_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -766,8 +765,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py index 6f2b5a067..8aa7a7793 100644 --- a/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_network_endpoint_groups.py @@ -120,21 +120,11 @@ def test_network_endpoint_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [NetworkEndpointGroupsClient,]) -def test_network_endpoint_groups_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.NetworkEndpointGroupsRestTransport, "rest"),], ) -def test_network_endpoint_groups_client_service_account_always_use_jwt_true( +def test_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_network_endpoint_groups_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [NetworkEndpointGroupsClient,]) def test_network_endpoint_groups_client_from_service_account_file(client_class): @@ -542,7 +539,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -749,14 +747,15 @@ def test_attach_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroupsAttachEndpointsRequest.to_json( network_endpoint_groups_attach_endpoints_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_attach_network_endpoints_rest_flattened_error(): @@ -893,9 +892,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1034,14 +1034,15 @@ def test_detach_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroupsDetachEndpointsRequest.to_json( network_endpoint_groups_detach_endpoints_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_detach_network_endpoints_rest_flattened_error(): @@ -1173,9 +1174,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1310,13 +1312,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroup.to_json( network_endpoint_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1414,8 +1417,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1585,14 +1589,15 @@ def test_list_network_endpoints_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroupsListEndpointsRequest.to_json( network_endpoint_groups_list_endpoints_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_list_network_endpoints_rest_flattened_error(): @@ -1745,14 +1750,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_networks.py b/tests/unit/gapic/compute_v1/test_networks.py index 564e970f3..385c7c697 100644 --- a/tests/unit/gapic/compute_v1/test_networks.py +++ b/tests/unit/gapic/compute_v1/test_networks.py @@ -112,20 +112,10 @@ def test_networks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [NetworksClient,]) -def test_networks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.NetworksRestTransport, "rest"),] ) -def test_networks_client_service_account_always_use_jwt_true( +def test_networks_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_networks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [NetworksClient,]) def test_networks_client_from_service_account_file(client_class): @@ -521,13 +518,14 @@ def test_add_peering_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) assert compute.NetworksAddPeeringRequest.to_json( networks_add_peering_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_peering_rest_flattened_error(): @@ -655,8 +653,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -759,8 +758,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -857,8 +857,9 @@ def test_get_effective_firewalls_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) def test_get_effective_firewalls_rest_flattened_error(): @@ -984,12 +985,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Network.to_json( network_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1072,7 +1074,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1199,8 +1202,9 @@ def test_list_peering_routes_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) def test_list_peering_routes_rest_flattened_error(): @@ -1379,13 +1383,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) assert compute.Network.to_json( network_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1516,13 +1521,14 @@ def test_remove_peering_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) assert compute.NetworksRemovePeeringRequest.to_json( networks_remove_peering_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_peering_rest_flattened_error(): @@ -1650,8 +1656,9 @@ def test_switch_to_custom_mode_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) def test_switch_to_custom_mode_rest_flattened_error(): @@ -1781,13 +1788,14 @@ def test_update_peering_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "network_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "network_value" in http_call[1] + str(body) + str(params) assert compute.NetworksUpdatePeeringRequest.to_json( networks_update_peering_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_peering_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_node_groups.py b/tests/unit/gapic/compute_v1/test_node_groups.py index cd142a262..4e48c96dd 100644 --- a/tests/unit/gapic/compute_v1/test_node_groups.py +++ b/tests/unit/gapic/compute_v1/test_node_groups.py @@ -114,20 +114,10 @@ def test_node_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [NodeGroupsClient,]) -def test_node_groups_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.NodeGroupsRestTransport, "rest"),] ) -def test_node_groups_client_service_account_always_use_jwt_true( +def test_node_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_node_groups_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [NodeGroupsClient,]) def test_node_groups_client_from_service_account_file(client_class): @@ -526,14 +523,15 @@ def test_add_nodes_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) assert compute.NodeGroupsAddNodesRequest.to_json( node_groups_add_nodes_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_nodes_rest_flattened_error(): @@ -642,7 +640,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -825,9 +824,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -959,14 +959,15 @@ def test_delete_nodes_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) assert compute.NodeGroupsDeleteNodesRequest.to_json( node_groups_delete_nodes_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_delete_nodes_rest_flattened_error(): @@ -1079,9 +1080,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1183,9 +1185,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1317,14 +1320,15 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert str(1911) in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert str(1911) in http_call[1] + str(body) + str(params) assert compute.NodeGroup.to_json( node_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1421,8 +1425,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1555,9 +1560,10 @@ def test_list_nodes_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) def test_list_nodes_rest_flattened_error(): @@ -1737,14 +1743,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) assert compute.NodeGroup.to_json( node_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1855,14 +1862,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.ZoneSetPolicyRequest.to_json( zone_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1997,14 +2005,15 @@ def test_set_node_template_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_group_value" in http_call[1] + str(body) + str(params) assert compute.NodeGroupsSetNodeTemplateRequest.to_json( node_groups_set_node_template_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_node_template_rest_flattened_error(): @@ -2091,14 +2100,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_node_templates.py b/tests/unit/gapic/compute_v1/test_node_templates.py index 45e5562c4..b71e569f3 100644 --- a/tests/unit/gapic/compute_v1/test_node_templates.py +++ b/tests/unit/gapic/compute_v1/test_node_templates.py @@ -117,20 +117,10 @@ def test_node_templates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [NodeTemplatesClient,]) -def test_node_templates_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.NodeTemplatesRestTransport, "rest"),] ) -def test_node_templates_client_service_account_always_use_jwt_true( +def test_node_templates_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -140,6 +130,13 @@ def test_node_templates_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [NodeTemplatesClient,]) def test_node_templates_client_from_service_account_file(client_class): @@ -507,7 +504,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -697,9 +695,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "node_template_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "node_template_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -818,9 +817,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "node_template_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "node_template_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -922,9 +922,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1055,13 +1056,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.NodeTemplate.to_json( node_template_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1159,8 +1161,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1315,14 +1318,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetPolicyRequest.to_json( region_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1409,14 +1413,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_node_types.py b/tests/unit/gapic/compute_v1/test_node_types.py index 96e9277aa..50305d33f 100644 --- a/tests/unit/gapic/compute_v1/test_node_types.py +++ b/tests/unit/gapic/compute_v1/test_node_types.py @@ -112,20 +112,10 @@ def test_node_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [NodeTypesClient,]) -def test_node_types_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.NodeTypesRestTransport, "rest"),] ) -def test_node_types_client_service_account_always_use_jwt_true( +def test_node_types_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_node_types_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [NodeTypesClient,]) def test_node_types_client_from_service_account_file(client_class): @@ -488,7 +485,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -643,9 +641,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "node_type_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "node_type_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -731,8 +730,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py index 7e65223c3..41e9c1012 100644 --- a/tests/unit/gapic/compute_v1/test_packet_mirrorings.py +++ b/tests/unit/gapic/compute_v1/test_packet_mirrorings.py @@ -118,21 +118,11 @@ def test_packet_mirrorings_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [PacketMirroringsClient,]) -def test_packet_mirrorings_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.PacketMirroringsRestTransport, "rest"),], ) -def test_packet_mirrorings_client_service_account_always_use_jwt_true( +def test_packet_mirrorings_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_packet_mirrorings_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [PacketMirroringsClient,]) def test_packet_mirrorings_client_from_service_account_file(client_class): @@ -521,7 +518,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -712,9 +710,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "packet_mirroring_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "packet_mirroring_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -840,9 +839,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "packet_mirroring_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "packet_mirroring_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -975,13 +975,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.PacketMirroring.to_json( packet_mirroring_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1085,8 +1086,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1267,14 +1269,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "packet_mirroring_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "packet_mirroring_value" in http_call[1] + str(body) + str(params) assert compute.PacketMirroring.to_json( packet_mirroring_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1364,14 +1367,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_projects.py b/tests/unit/gapic/compute_v1/test_projects.py index 1d0aa1c8c..52f73c597 100644 --- a/tests/unit/gapic/compute_v1/test_projects.py +++ b/tests/unit/gapic/compute_v1/test_projects.py @@ -112,20 +112,10 @@ def test_projects_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ProjectsClient,]) -def test_projects_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ProjectsRestTransport, "rest"),] ) -def test_projects_client_service_account_always_use_jwt_true( +def test_projects_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_projects_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ProjectsClient,]) def test_projects_client_from_service_account_file(client_class): @@ -514,7 +511,8 @@ def test_disable_xpn_host_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_disable_xpn_host_rest_flattened_error(): @@ -641,12 +639,13 @@ def test_disable_xpn_resource_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ProjectsDisableXpnResourceRequest.to_json( projects_disable_xpn_resource_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_disable_xpn_resource_rest_flattened_error(): @@ -771,7 +770,8 @@ def test_enable_xpn_host_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_enable_xpn_host_rest_flattened_error(): @@ -898,12 +898,13 @@ def test_enable_xpn_resource_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ProjectsEnableXpnResourceRequest.to_json( projects_enable_xpn_resource_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_enable_xpn_resource_rest_flattened_error(): @@ -1008,7 +1009,8 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1111,7 +1113,8 @@ def test_get_xpn_host_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_get_xpn_host_rest_flattened_error(): @@ -1188,7 +1191,8 @@ def test_get_xpn_resources_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_get_xpn_resources_rest_flattened_error(): @@ -1335,12 +1339,13 @@ def test_list_xpn_hosts_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ProjectsListXpnHostsRequest.to_json( projects_list_xpn_hosts_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_list_xpn_hosts_rest_flattened_error(): @@ -1511,12 +1516,13 @@ def test_move_disk_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.DiskMoveRequest.to_json( disk_move_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_move_disk_rest_flattened_error(): @@ -1647,12 +1653,13 @@ def test_move_instance_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.InstanceMoveRequest.to_json( instance_move_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_move_instance_rest_flattened_error(): @@ -1781,12 +1788,13 @@ def test_set_common_instance_metadata_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Metadata.to_json( metadata_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_common_instance_metadata_rest_flattened_error(): @@ -1915,12 +1923,13 @@ def test_set_default_network_tier_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.ProjectsSetDefaultNetworkTierRequest.to_json( projects_set_default_network_tier_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_default_network_tier_rest_flattened_error(): @@ -2051,12 +2060,13 @@ def test_set_usage_export_bucket_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.UsageExportLocation.to_json( usage_export_location_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_usage_export_bucket_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py index c2f1e0f09..a37158ba4 100644 --- a/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_advertised_prefixes.py @@ -120,21 +120,11 @@ def test_public_advertised_prefixes_client_from_service_account_info(client_clas assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [PublicAdvertisedPrefixesClient,]) -def test_public_advertised_prefixes_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.PublicAdvertisedPrefixesRestTransport, "rest"),], ) -def test_public_advertised_prefixes_client_service_account_always_use_jwt_true( +def test_public_advertised_prefixes_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_public_advertised_prefixes_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [PublicAdvertisedPrefixesClient,]) def test_public_advertised_prefixes_client_from_service_account_file(client_class): @@ -566,8 +563,11 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_advertised_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_advertised_prefix_value" in http_call[1] + str(body) + str( + params + ) def test_delete_rest_flattened_error(): @@ -677,8 +677,11 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_advertised_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_advertised_prefix_value" in http_call[1] + str(body) + str( + params + ) def test_get_rest_flattened_error(): @@ -811,12 +814,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.PublicAdvertisedPrefix.to_json( public_advertised_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -913,7 +917,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1100,13 +1105,16 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "public_advertised_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "public_advertised_prefix_value" in http_call[1] + str(body) + str( + params + ) assert compute.PublicAdvertisedPrefix.to_json( public_advertised_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py index 31e370cdc..cc8ee28f4 100644 --- a/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py +++ b/tests/unit/gapic/compute_v1/test_public_delegated_prefixes.py @@ -120,21 +120,11 @@ def test_public_delegated_prefixes_client_from_service_account_info(client_class assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [PublicDelegatedPrefixesClient,]) -def test_public_delegated_prefixes_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.PublicDelegatedPrefixesRestTransport, "rest"),], ) -def test_public_delegated_prefixes_client_service_account_always_use_jwt_true( +def test_public_delegated_prefixes_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_public_delegated_prefixes_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [PublicDelegatedPrefixesClient,]) def test_public_delegated_prefixes_client_from_service_account_file(client_class): @@ -544,7 +541,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -744,9 +742,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -862,9 +861,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -999,13 +999,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.PublicDelegatedPrefix.to_json( public_delegated_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1105,8 +1106,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1294,14 +1296,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "public_delegated_prefix_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "public_delegated_prefix_value" in http_call[1] + str(body) + str(params) assert compute.PublicDelegatedPrefix.to_json( public_delegated_prefix_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_autoscalers.py b/tests/unit/gapic/compute_v1/test_region_autoscalers.py index 236c130e9..a1702fecf 100644 --- a/tests/unit/gapic/compute_v1/test_region_autoscalers.py +++ b/tests/unit/gapic/compute_v1/test_region_autoscalers.py @@ -118,21 +118,11 @@ def test_region_autoscalers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionAutoscalersClient,]) -def test_region_autoscalers_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionAutoscalersRestTransport, "rest"),], ) -def test_region_autoscalers_client_service_account_always_use_jwt_true( +def test_region_autoscalers_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_region_autoscalers_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionAutoscalersClient,]) def test_region_autoscalers_client_from_service_account_file(client_class): @@ -541,9 +538,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "autoscaler_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "autoscaler_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -661,9 +659,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "autoscaler_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "autoscaler_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -794,13 +793,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -900,8 +900,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1079,13 +1080,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1218,13 +1220,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Autoscaler.to_json( autoscaler_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_backend_services.py b/tests/unit/gapic/compute_v1/test_region_backend_services.py index f21c6a2be..e92ab0aa4 100644 --- a/tests/unit/gapic/compute_v1/test_region_backend_services.py +++ b/tests/unit/gapic/compute_v1/test_region_backend_services.py @@ -120,21 +120,11 @@ def test_region_backend_services_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionBackendServicesClient,]) -def test_region_backend_services_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionBackendServicesRestTransport, "rest"),], ) -def test_region_backend_services_client_service_account_always_use_jwt_true( +def test_region_backend_services_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_region_backend_services_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionBackendServicesClient,]) def test_region_backend_services_client_from_service_account_file(client_class): @@ -563,9 +560,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -757,9 +755,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -855,14 +854,15 @@ def test_get_health_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.ResourceGroupReference.to_json( resource_group_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_get_health_rest_flattened_error(): @@ -998,13 +998,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1098,8 +1099,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1282,14 +1284,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1426,14 +1429,15 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "backend_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "backend_service_value" in http_call[1] + str(body) + str(params) assert compute.BackendService.to_json( backend_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_commitments.py b/tests/unit/gapic/compute_v1/test_region_commitments.py index 6275a1ea8..646b10fe4 100644 --- a/tests/unit/gapic/compute_v1/test_region_commitments.py +++ b/tests/unit/gapic/compute_v1/test_region_commitments.py @@ -118,21 +118,11 @@ def test_region_commitments_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionCommitmentsClient,]) -def test_region_commitments_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionCommitmentsRestTransport, "rest"),], ) -def test_region_commitments_client_service_account_always_use_jwt_true( +def test_region_commitments_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_region_commitments_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionCommitmentsClient,]) def test_region_commitments_client_from_service_account_file(client_class): @@ -517,7 +514,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -691,9 +689,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "commitment_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "commitment_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -824,13 +823,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Commitment.to_json( commitment_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -926,8 +926,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_disk_types.py b/tests/unit/gapic/compute_v1/test_region_disk_types.py index 945947b72..eb9da29f9 100644 --- a/tests/unit/gapic/compute_v1/test_region_disk_types.py +++ b/tests/unit/gapic/compute_v1/test_region_disk_types.py @@ -117,21 +117,11 @@ def test_region_disk_types_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionDiskTypesClient,]) -def test_region_disk_types_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionDiskTypesRestTransport, "rest"),], ) -def test_region_disk_types_client_service_account_always_use_jwt_true( +def test_region_disk_types_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_region_disk_types_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionDiskTypesClient,]) def test_region_disk_types_client_from_service_account_file(client_class): @@ -510,9 +507,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_type_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_type_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -602,8 +600,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_disks.py b/tests/unit/gapic/compute_v1/test_region_disks.py index d7fa6b861..cde064f89 100644 --- a/tests/unit/gapic/compute_v1/test_region_disks.py +++ b/tests/unit/gapic/compute_v1/test_region_disks.py @@ -114,20 +114,10 @@ def test_region_disks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionDisksClient,]) -def test_region_disks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionDisksRestTransport, "rest"),] ) -def test_region_disks_client_service_account_always_use_jwt_true( +def test_region_disks_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_region_disks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionDisksClient,]) def test_region_disks_client_from_service_account_file(client_class): @@ -526,14 +523,15 @@ def test_add_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.RegionDisksAddResourcePoliciesRequest.to_json( region_disks_add_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_resource_policies_rest_flattened_error(): @@ -666,14 +664,15 @@ def test_create_snapshot_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.Snapshot.to_json( snapshot_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_create_snapshot_rest_flattened_error(): @@ -800,9 +799,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -968,9 +968,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1072,9 +1073,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1201,13 +1203,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Disk.to_json( disk_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1297,8 +1300,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1470,14 +1474,15 @@ def test_remove_resource_policies_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.RegionDisksRemoveResourcePoliciesRequest.to_json( region_disks_remove_resource_policies_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_resource_policies_rest_flattened_error(): @@ -1612,14 +1617,15 @@ def test_resize_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "disk_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "disk_value" in http_call[1] + str(body) + str(params) assert compute.RegionDisksResizeRequest.to_json( region_disks_resize_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_resize_rest_flattened_error(): @@ -1730,14 +1736,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetPolicyRequest.to_json( region_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1872,14 +1879,15 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetLabelsRequest.to_json( region_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1966,14 +1974,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_health_check_services.py b/tests/unit/gapic/compute_v1/test_region_health_check_services.py index 1ed0f9479..4b9f049af 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_check_services.py +++ b/tests/unit/gapic/compute_v1/test_region_health_check_services.py @@ -122,23 +122,11 @@ def test_region_health_check_services_client_from_service_account_info(client_cl assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionHealthCheckServicesClient,]) -def test_region_health_check_services_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionHealthCheckServicesRestTransport, "rest"),], ) -def test_region_health_check_services_client_service_account_always_use_jwt_true( +def test_region_health_check_services_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_region_health_check_services_client_service_account_always_use_jwt_true transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionHealthCheckServicesClient,]) def test_region_health_check_services_client_from_service_account_file(client_class): @@ -571,9 +566,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_service_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -682,9 +678,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_service_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -819,13 +816,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheckService.to_json( health_check_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -925,8 +923,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1111,14 +1110,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_service_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_service_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheckService.to_json( health_check_service_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_health_checks.py b/tests/unit/gapic/compute_v1/test_region_health_checks.py index 509840794..61b02d822 100644 --- a/tests/unit/gapic/compute_v1/test_region_health_checks.py +++ b/tests/unit/gapic/compute_v1/test_region_health_checks.py @@ -120,21 +120,11 @@ def test_region_health_checks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionHealthChecksClient,]) -def test_region_health_checks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionHealthChecksRestTransport, "rest"),], ) -def test_region_health_checks_client_service_account_always_use_jwt_true( +def test_region_health_checks_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_region_health_checks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionHealthChecksClient,]) def test_region_health_checks_client_from_service_account_file(client_class): @@ -545,9 +542,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -671,9 +669,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -806,13 +805,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -904,8 +904,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1088,14 +1089,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1230,14 +1232,15 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "health_check_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "health_check_value" in http_call[1] + str(body) + str(params) assert compute.HealthCheck.to_json( health_check_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py index 5171ec0f0..6acebbaaa 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_group_managers.py @@ -122,23 +122,11 @@ def test_region_instance_group_managers_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionInstanceGroupManagersClient,]) -def test_region_instance_group_managers_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionInstanceGroupManagersRestTransport, "rest"),], ) -def test_region_instance_group_managers_client_service_account_always_use_jwt_true( +def test_region_instance_group_managers_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_region_instance_group_managers_client_service_account_always_use_jwt_tr transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionInstanceGroupManagersClient,]) def test_region_instance_group_managers_client_from_service_account_file(client_class): @@ -576,14 +571,15 @@ def test_abandon_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersAbandonInstancesRequest.to_json( region_instance_group_managers_abandon_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_abandon_instances_rest_flattened_error(): @@ -723,14 +719,15 @@ def test_apply_updates_to_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersApplyUpdatesRequest.to_json( region_instance_group_managers_apply_updates_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_apply_updates_to_instances_rest_flattened_error(): @@ -870,14 +867,15 @@ def test_create_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersCreateInstancesRequest.to_json( region_instance_group_managers_create_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_create_instances_rest_flattened_error(): @@ -1013,9 +1011,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1152,14 +1151,15 @@ def test_delete_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersDeleteInstancesRequest.to_json( region_instance_group_managers_delete_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_delete_instances_rest_flattened_error(): @@ -1299,14 +1299,15 @@ def test_delete_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagerDeleteInstanceConfigReq.to_json( region_instance_group_manager_delete_instance_config_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_delete_per_instance_configs_rest_flattened_error(): @@ -1475,9 +1476,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1617,13 +1619,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManager.to_json( instance_group_manager_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1737,8 +1740,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1892,9 +1896,10 @@ def test_list_errors_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_errors_rest_flattened_error(): @@ -2051,9 +2056,10 @@ def test_list_managed_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_managed_instances_rest_flattened_error(): @@ -2206,9 +2212,10 @@ def test_list_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) def test_list_per_instance_configs_rest_flattened_error(): @@ -2403,14 +2410,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.InstanceGroupManager.to_json( instance_group_manager_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -2556,14 +2564,15 @@ def test_patch_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagerPatchInstanceConfigReq.to_json( region_instance_group_manager_patch_instance_config_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_per_instance_configs_rest_flattened_error(): @@ -2705,14 +2714,15 @@ def test_recreate_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersRecreateRequest.to_json( region_instance_group_managers_recreate_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_recreate_instances_rest_flattened_error(): @@ -2849,10 +2859,11 @@ def test_resize_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) - assert str(443) in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) + assert str(443) in http_call[1] + str(body) + str(params) def test_resize_rest_flattened_error(): @@ -2990,14 +3001,15 @@ def test_set_instance_template_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersSetTemplateRequest.to_json( region_instance_group_managers_set_template_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_instance_template_rest_flattened_error(): @@ -3137,14 +3149,15 @@ def test_set_target_pools_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagersSetTargetPoolsRequest.to_json( region_instance_group_managers_set_target_pools_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_target_pools_rest_flattened_error(): @@ -3286,14 +3299,15 @@ def test_update_per_instance_configs_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_manager_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_manager_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupManagerUpdateInstanceConfigReq.to_json( region_instance_group_manager_update_instance_config_req_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_per_instance_configs_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_instance_groups.py b/tests/unit/gapic/compute_v1/test_region_instance_groups.py index 096941fb9..b388ac57c 100644 --- a/tests/unit/gapic/compute_v1/test_region_instance_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_instance_groups.py @@ -120,21 +120,11 @@ def test_region_instance_groups_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionInstanceGroupsClient,]) -def test_region_instance_groups_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionInstanceGroupsRestTransport, "rest"),], ) -def test_region_instance_groups_client_service_account_always_use_jwt_true( +def test_region_instance_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_region_instance_groups_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionInstanceGroupsClient,]) def test_region_instance_groups_client_from_service_account_file(client_class): @@ -539,9 +536,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -637,8 +635,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -790,14 +789,15 @@ def test_list_instances_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupsListInstancesRequest.to_json( region_instance_groups_list_instances_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_list_instances_rest_flattened_error(): @@ -992,14 +992,15 @@ def test_set_named_ports_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "instance_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "instance_group_value" in http_call[1] + str(body) + str(params) assert compute.RegionInstanceGroupsSetNamedPortsRequest.to_json( region_instance_groups_set_named_ports_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_named_ports_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_instances.py b/tests/unit/gapic/compute_v1/test_region_instances.py index e69b578ab..191b8ad93 100644 --- a/tests/unit/gapic/compute_v1/test_region_instances.py +++ b/tests/unit/gapic/compute_v1/test_region_instances.py @@ -116,21 +116,11 @@ def test_region_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionInstancesClient,]) -def test_region_instances_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionInstancesRestTransport, "rest"),], ) -def test_region_instances_client_service_account_always_use_jwt_true( +def test_region_instances_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -140,6 +130,13 @@ def test_region_instances_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionInstancesClient,]) def test_region_instances_client_from_service_account_file(client_class): @@ -542,13 +539,14 @@ def test_bulk_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.BulkInsertInstanceResource.to_json( bulk_insert_instance_resource_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_bulk_insert_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py index 5945277a7..89527269d 100644 --- a/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py +++ b/tests/unit/gapic/compute_v1/test_region_network_endpoint_groups.py @@ -122,23 +122,11 @@ def test_region_network_endpoint_groups_client_from_service_account_info(client_ assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionNetworkEndpointGroupsClient,]) -def test_region_network_endpoint_groups_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionNetworkEndpointGroupsRestTransport, "rest"),], ) -def test_region_network_endpoint_groups_client_service_account_always_use_jwt_true( +def test_region_network_endpoint_groups_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_region_network_endpoint_groups_client_service_account_always_use_jwt_tr transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionNetworkEndpointGroupsClient,]) def test_region_network_endpoint_groups_client_from_service_account_file(client_class): @@ -572,9 +567,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -701,9 +697,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "network_endpoint_group_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "network_endpoint_group_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -839,13 +836,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.NetworkEndpointGroup.to_json( network_endpoint_group_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -943,8 +941,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py index 1084c8f1f..fe13f3563 100644 --- a/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py +++ b/tests/unit/gapic/compute_v1/test_region_notification_endpoints.py @@ -122,23 +122,11 @@ def test_region_notification_endpoints_client_from_service_account_info(client_c assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionNotificationEndpointsClient,]) -def test_region_notification_endpoints_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionNotificationEndpointsRestTransport, "rest"),], ) -def test_region_notification_endpoints_client_service_account_always_use_jwt_true( +def test_region_notification_endpoints_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -148,6 +136,13 @@ def test_region_notification_endpoints_client_service_account_always_use_jwt_tru transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionNotificationEndpointsClient,]) def test_region_notification_endpoints_client_from_service_account_file(client_class): @@ -572,9 +567,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "notification_endpoint_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "notification_endpoint_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -676,9 +672,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "notification_endpoint_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "notification_endpoint_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -814,13 +811,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.NotificationEndpoint.to_json( notification_endpoint_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -920,8 +918,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_operations.py b/tests/unit/gapic/compute_v1/test_region_operations.py index bc6076e5a..ab978f284 100644 --- a/tests/unit/gapic/compute_v1/test_region_operations.py +++ b/tests/unit/gapic/compute_v1/test_region_operations.py @@ -118,21 +118,11 @@ def test_region_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionOperationsClient,]) -def test_region_operations_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionOperationsRestTransport, "rest"),], ) -def test_region_operations_client_service_account_always_use_jwt_true( +def test_region_operations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_region_operations_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionOperationsClient,]) def test_region_operations_client_from_service_account_file(client_class): @@ -488,9 +485,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -616,9 +614,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -708,8 +707,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -874,9 +874,10 @@ def test_wait_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_wait_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py index f056c569d..f107ffb9b 100644 --- a/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_region_ssl_certificates.py @@ -120,21 +120,11 @@ def test_region_ssl_certificates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionSslCertificatesClient,]) -def test_region_ssl_certificates_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionSslCertificatesRestTransport, "rest"),], ) -def test_region_ssl_certificates_client_service_account_always_use_jwt_true( +def test_region_ssl_certificates_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_region_ssl_certificates_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionSslCertificatesClient,]) def test_region_ssl_certificates_client_from_service_account_file(client_class): @@ -563,9 +560,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "ssl_certificate_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "ssl_certificate_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -683,9 +681,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "ssl_certificate_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "ssl_certificate_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -820,13 +819,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.SslCertificate.to_json( ssl_certificate_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -920,8 +920,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py index f6e2a038e..2fc88ebc5 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_http_proxies.py @@ -120,21 +120,11 @@ def test_region_target_http_proxies_client_from_service_account_info(client_clas assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionTargetHttpProxiesClient,]) -def test_region_target_http_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionTargetHttpProxiesRestTransport, "rest"),], ) -def test_region_target_http_proxies_client_service_account_always_use_jwt_true( +def test_region_target_http_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_region_target_http_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionTargetHttpProxiesClient,]) def test_region_target_http_proxies_client_from_service_account_file(client_class): @@ -563,9 +560,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -667,9 +665,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -804,13 +803,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpProxy.to_json( target_http_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -908,8 +908,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1092,14 +1093,15 @@ def test_set_url_map_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) assert compute.UrlMapReference.to_json( url_map_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_url_map_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py index 2db040d9b..580ad0a38 100644 --- a/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_region_target_https_proxies.py @@ -120,23 +120,11 @@ def test_region_target_https_proxies_client_from_service_account_info(client_cla assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionTargetHttpsProxiesClient,]) -def test_region_target_https_proxies_client_service_account_always_use_jwt( - client_class, -): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionTargetHttpsProxiesRestTransport, "rest"),], ) -def test_region_target_https_proxies_client_service_account_always_use_jwt_true( +def test_region_target_https_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -146,6 +134,13 @@ def test_region_target_https_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionTargetHttpsProxiesClient,]) def test_region_target_https_proxies_client_from_service_account_file(client_class): @@ -569,9 +564,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -683,9 +679,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -820,13 +817,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpsProxy.to_json( target_https_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -926,8 +924,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1113,14 +1112,15 @@ def test_set_ssl_certificates_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.RegionTargetHttpsProxiesSetSslCertificatesRequest.to_json( region_target_https_proxies_set_ssl_certificates_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_ssl_certificates_rest_flattened_error(): @@ -1257,14 +1257,15 @@ def test_set_url_map_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.UrlMapReference.to_json( url_map_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_url_map_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_region_url_maps.py b/tests/unit/gapic/compute_v1/test_region_url_maps.py index c9e9e3472..0c2fa29a7 100644 --- a/tests/unit/gapic/compute_v1/test_region_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_region_url_maps.py @@ -117,20 +117,10 @@ def test_region_url_maps_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionUrlMapsClient,]) -def test_region_url_maps_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionUrlMapsRestTransport, "rest"),] ) -def test_region_url_maps_client_service_account_always_use_jwt_true( +def test_region_url_maps_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -140,6 +130,13 @@ def test_region_url_maps_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionUrlMapsClient,]) def test_region_url_maps_client_from_service_account_file(client_class): @@ -527,9 +524,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -661,9 +659,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -792,13 +791,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -890,8 +890,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1060,14 +1061,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1200,14 +1202,15 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): @@ -1296,14 +1299,15 @@ def test_validate_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.RegionUrlMapsValidateRequest.to_json( region_url_maps_validate_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_validate_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_regions.py b/tests/unit/gapic/compute_v1/test_regions.py index a8fa3798e..a4bbce669 100644 --- a/tests/unit/gapic/compute_v1/test_regions.py +++ b/tests/unit/gapic/compute_v1/test_regions.py @@ -111,22 +111,10 @@ def test_regions_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RegionsClient,]) -def test_regions_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RegionsRestTransport, "rest"),] ) -def test_regions_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_regions_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -134,6 +122,13 @@ def test_regions_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RegionsClient,]) def test_regions_client_from_service_account_file(client_class): @@ -485,8 +480,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -569,7 +565,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_reservations.py b/tests/unit/gapic/compute_v1/test_reservations.py index 0f1efffb2..7996bee17 100644 --- a/tests/unit/gapic/compute_v1/test_reservations.py +++ b/tests/unit/gapic/compute_v1/test_reservations.py @@ -114,20 +114,10 @@ def test_reservations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ReservationsClient,]) -def test_reservations_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ReservationsRestTransport, "rest"),] ) -def test_reservations_client_service_account_always_use_jwt_true( +def test_reservations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_reservations_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ReservationsClient,]) def test_reservations_client_from_service_account_file(client_class): @@ -490,7 +487,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -676,9 +674,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "reservation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "reservation_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -778,9 +777,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "reservation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "reservation_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -882,9 +882,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1013,13 +1014,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.Reservation.to_json( reservation_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1107,8 +1109,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1287,14 +1290,15 @@ def test_resize_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "reservation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "reservation_value" in http_call[1] + str(body) + str(params) assert compute.ReservationsResizeRequest.to_json( reservations_resize_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_resize_rest_flattened_error(): @@ -1405,14 +1409,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.ZoneSetPolicyRequest.to_json( zone_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1499,14 +1504,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_resource_policies.py b/tests/unit/gapic/compute_v1/test_resource_policies.py index e109cc304..8831229a6 100644 --- a/tests/unit/gapic/compute_v1/test_resource_policies.py +++ b/tests/unit/gapic/compute_v1/test_resource_policies.py @@ -118,21 +118,11 @@ def test_resource_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ResourcePoliciesClient,]) -def test_resource_policies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ResourcePoliciesRestTransport, "rest"),], ) -def test_resource_policies_client_service_account_always_use_jwt_true( +def test_resource_policies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_resource_policies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ResourcePoliciesClient,]) def test_resource_policies_client_from_service_account_file(client_class): @@ -517,7 +514,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -708,9 +706,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_policy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -843,9 +842,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_policy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -947,9 +947,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1080,13 +1081,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.ResourcePolicy.to_json( resource_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1182,8 +1184,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1338,14 +1341,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetPolicyRequest.to_json( region_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1433,14 +1437,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_routers.py b/tests/unit/gapic/compute_v1/test_routers.py index 18bb16851..10545aa69 100644 --- a/tests/unit/gapic/compute_v1/test_routers.py +++ b/tests/unit/gapic/compute_v1/test_routers.py @@ -111,22 +111,10 @@ def test_routers_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RoutersClient,]) -def test_routers_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RoutersRestTransport, "rest"),] ) -def test_routers_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_routers_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -134,6 +122,13 @@ def test_routers_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RoutersClient,]) def test_routers_client_from_service_account_file(client_class): @@ -497,7 +492,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -678,9 +674,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -790,9 +787,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -882,9 +880,10 @@ def test_get_nat_mapping_info_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) def test_get_nat_mapping_info_rest_flattened_error(): @@ -1021,9 +1020,10 @@ def test_get_router_status_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) def test_get_router_status_rest_flattened_error(): @@ -1152,13 +1152,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Router.to_json( router_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1258,8 +1259,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1428,14 +1430,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) assert compute.Router.to_json( router_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1530,14 +1533,15 @@ def test_preview_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) assert compute.Router.to_json( router_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_preview_rest_flattened_error(): @@ -1672,14 +1676,15 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "router_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "router_value" in http_call[1] + str(body) + str(params) assert compute.Router.to_json( router_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_routes.py b/tests/unit/gapic/compute_v1/test_routes.py index 5d524e6b6..aed46e74a 100644 --- a/tests/unit/gapic/compute_v1/test_routes.py +++ b/tests/unit/gapic/compute_v1/test_routes.py @@ -109,22 +109,10 @@ def test_routes_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [RoutesClient,]) -def test_routes_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.RoutesRestTransport, "rest"),] ) -def test_routes_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_routes_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -132,6 +120,13 @@ def test_routes_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [RoutesClient,]) def test_routes_client_from_service_account_file(client_class): @@ -511,8 +506,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "route_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "route_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -621,8 +617,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "route_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "route_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -744,12 +741,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.Route.to_json( route_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -834,7 +832,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_security_policies.py b/tests/unit/gapic/compute_v1/test_security_policies.py index b8f83b49d..7db7b6e47 100644 --- a/tests/unit/gapic/compute_v1/test_security_policies.py +++ b/tests/unit/gapic/compute_v1/test_security_policies.py @@ -118,21 +118,11 @@ def test_security_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [SecurityPoliciesClient,]) -def test_security_policies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.SecurityPoliciesRestTransport, "rest"),], ) -def test_security_policies_client_service_account_always_use_jwt_true( +def test_security_policies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_security_policies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [SecurityPoliciesClient,]) def test_security_policies_client_from_service_account_file(client_class): @@ -544,13 +541,14 @@ def test_add_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) assert compute.SecurityPolicyRule.to_json( security_policy_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_rule_rest_flattened_error(): @@ -678,8 +676,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -770,8 +769,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -866,8 +866,9 @@ def test_get_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) def test_get_rule_rest_flattened_error(): @@ -995,12 +996,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.SecurityPolicy.to_json( security_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1089,7 +1091,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1227,7 +1230,8 @@ def test_list_preconfigured_expression_sets_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_preconfigured_expression_sets_rest_flattened_error(): @@ -1356,13 +1360,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) assert compute.SecurityPolicy.to_json( security_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1495,13 +1500,14 @@ def test_patch_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) assert compute.SecurityPolicyRule.to_json( security_policy_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rule_rest_flattened_error(): @@ -1629,8 +1635,9 @@ def test_remove_rule_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "security_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "security_policy_value" in http_call[1] + str(body) + str(params) def test_remove_rule_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_snapshots.py b/tests/unit/gapic/compute_v1/test_snapshots.py index 0150518d9..7f9b403e2 100644 --- a/tests/unit/gapic/compute_v1/test_snapshots.py +++ b/tests/unit/gapic/compute_v1/test_snapshots.py @@ -112,20 +112,10 @@ def test_snapshots_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [SnapshotsClient,]) -def test_snapshots_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.SnapshotsRestTransport, "rest"),] ) -def test_snapshots_client_service_account_always_use_jwt_true( +def test_snapshots_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -135,6 +125,13 @@ def test_snapshots_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [SnapshotsClient,]) def test_snapshots_client_from_service_account_file(client_class): @@ -516,8 +513,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "snapshot_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "snapshot_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -646,8 +644,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "snapshot_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "snapshot_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -748,8 +747,9 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -832,7 +832,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -976,13 +977,14 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetPolicyRequest.to_json( global_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1115,13 +1117,14 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.GlobalSetLabelsRequest.to_json( global_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1206,13 +1209,14 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_ssl_certificates.py b/tests/unit/gapic/compute_v1/test_ssl_certificates.py index ce055b283..f1673c7e1 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_certificates.py +++ b/tests/unit/gapic/compute_v1/test_ssl_certificates.py @@ -117,21 +117,11 @@ def test_ssl_certificates_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [SslCertificatesClient,]) -def test_ssl_certificates_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.SslCertificatesRestTransport, "rest"),], ) -def test_ssl_certificates_client_service_account_always_use_jwt_true( +def test_ssl_certificates_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_ssl_certificates_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [SslCertificatesClient,]) def test_ssl_certificates_client_from_service_account_file(client_class): @@ -510,7 +507,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -699,8 +697,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "ssl_certificate_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "ssl_certificate_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -811,8 +810,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "ssl_certificate_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "ssl_certificate_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -940,12 +940,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.SslCertificate.to_json( ssl_certificate_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1032,7 +1033,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_ssl_policies.py b/tests/unit/gapic/compute_v1/test_ssl_policies.py index 7be318868..b92d387e0 100644 --- a/tests/unit/gapic/compute_v1/test_ssl_policies.py +++ b/tests/unit/gapic/compute_v1/test_ssl_policies.py @@ -114,20 +114,10 @@ def test_ssl_policies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [SslPoliciesClient,]) -def test_ssl_policies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.SslPoliciesRestTransport, "rest"),] ) -def test_ssl_policies_client_service_account_always_use_jwt_true( +def test_ssl_policies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_ssl_policies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [SslPoliciesClient,]) def test_ssl_policies_client_from_service_account_file(client_class): @@ -520,8 +517,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "ssl_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "ssl_policy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -620,8 +618,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "ssl_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "ssl_policy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -749,12 +748,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.SslPolicy.to_json( ssl_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -843,7 +843,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -963,7 +964,8 @@ def test_list_available_features_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_available_features_rest_flattened_error(): @@ -1091,13 +1093,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "ssl_policy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "ssl_policy_value" in http_call[1] + str(body) + str(params) assert compute.SslPolicy.to_json( ssl_policy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_subnetworks.py b/tests/unit/gapic/compute_v1/test_subnetworks.py index f77bb3b65..cb7294140 100644 --- a/tests/unit/gapic/compute_v1/test_subnetworks.py +++ b/tests/unit/gapic/compute_v1/test_subnetworks.py @@ -114,20 +114,10 @@ def test_subnetworks_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [SubnetworksClient,]) -def test_subnetworks_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.SubnetworksRestTransport, "rest"),] ) -def test_subnetworks_client_service_account_always_use_jwt_true( +def test_subnetworks_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_subnetworks_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [SubnetworksClient,]) def test_subnetworks_client_from_service_account_file(client_class): @@ -496,7 +493,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -684,9 +682,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "subnetwork_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "subnetwork_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -818,14 +817,15 @@ def test_expand_ip_cidr_range_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "subnetwork_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "subnetwork_value" in http_call[1] + str(body) + str(params) assert compute.SubnetworksExpandIpCidrRangeRequest.to_json( subnetworks_expand_ip_cidr_range_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_expand_ip_cidr_range_rest_flattened_error(): @@ -955,9 +955,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "subnetwork_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "subnetwork_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1059,9 +1060,10 @@ def test_get_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) def test_get_iam_policy_rest_flattened_error(): @@ -1192,13 +1194,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.Subnetwork.to_json( subnetwork_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1290,8 +1293,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1430,7 +1434,8 @@ def test_list_usable_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_usable_rest_flattened_error(): @@ -1609,14 +1614,15 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "subnetwork_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "subnetwork_value" in http_call[1] + str(body) + str(params) assert compute.Subnetwork.to_json( subnetwork_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1727,14 +1733,15 @@ def test_set_iam_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetPolicyRequest.to_json( region_set_policy_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_iam_policy_rest_flattened_error(): @@ -1870,14 +1877,15 @@ def test_set_private_ip_google_access_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "subnetwork_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "subnetwork_value" in http_call[1] + str(body) + str(params) assert compute.SubnetworksSetPrivateIpGoogleAccessRequest.to_json( subnetworks_set_private_ip_google_access_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_private_ip_google_access_rest_flattened_error(): @@ -1964,14 +1972,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py index 5c53e4eb7..1290b6ef8 100644 --- a/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_grpc_proxies.py @@ -118,21 +118,11 @@ def test_target_grpc_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetGrpcProxiesClient,]) -def test_target_grpc_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetGrpcProxiesRestTransport, "rest"),], ) -def test_target_grpc_proxies_client_service_account_always_use_jwt_true( +def test_target_grpc_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_target_grpc_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetGrpcProxiesClient,]) def test_target_grpc_proxies_client_from_service_account_file(client_class): @@ -539,8 +536,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_grpc_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_grpc_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -635,8 +633,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_grpc_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_grpc_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -765,12 +764,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.TargetGrpcProxy.to_json( target_grpc_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -861,7 +861,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1037,13 +1038,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_grpc_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_grpc_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetGrpcProxy.to_json( target_grpc_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_http_proxies.py b/tests/unit/gapic/compute_v1/test_target_http_proxies.py index 3820fa3c9..932e4a888 100644 --- a/tests/unit/gapic/compute_v1/test_target_http_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_http_proxies.py @@ -118,21 +118,11 @@ def test_target_http_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetHttpProxiesClient,]) -def test_target_http_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetHttpProxiesRestTransport, "rest"),], ) -def test_target_http_proxies_client_service_account_always_use_jwt_true( +def test_target_http_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_target_http_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetHttpProxiesClient,]) def test_target_http_proxies_client_from_service_account_file(client_class): @@ -513,7 +510,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -702,8 +700,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -798,8 +797,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -928,12 +928,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpProxy.to_json( target_http_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1024,7 +1025,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1200,13 +1202,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpProxy.to_json( target_http_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1337,13 +1340,14 @@ def test_set_url_map_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_http_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_http_proxy_value" in http_call[1] + str(body) + str(params) assert compute.UrlMapReference.to_json( url_map_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_url_map_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_https_proxies.py b/tests/unit/gapic/compute_v1/test_target_https_proxies.py index 72234c2c8..4cd46442c 100644 --- a/tests/unit/gapic/compute_v1/test_target_https_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_https_proxies.py @@ -120,21 +120,11 @@ def test_target_https_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetHttpsProxiesClient,]) -def test_target_https_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetHttpsProxiesRestTransport, "rest"),], ) -def test_target_https_proxies_client_service_account_always_use_jwt_true( +def test_target_https_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -144,6 +134,13 @@ def test_target_https_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetHttpsProxiesClient,]) def test_target_https_proxies_client_from_service_account_file(client_class): @@ -522,7 +519,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -717,8 +715,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -827,8 +826,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -961,12 +961,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpsProxy.to_json( target_https_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1063,7 +1064,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1245,13 +1247,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpsProxy.to_json( target_https_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1388,13 +1391,14 @@ def test_set_quic_override_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpsProxiesSetQuicOverrideRequest.to_json( target_https_proxies_set_quic_override_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_quic_override_rest_flattened_error(): @@ -1532,13 +1536,14 @@ def test_set_ssl_certificates_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetHttpsProxiesSetSslCertificatesRequest.to_json( target_https_proxies_set_ssl_certificates_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_ssl_certificates_rest_flattened_error(): @@ -1675,13 +1680,14 @@ def test_set_ssl_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.SslPolicyReference.to_json( ssl_policy_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_ssl_policy_rest_flattened_error(): @@ -1816,13 +1822,14 @@ def test_set_url_map_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_https_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_https_proxy_value" in http_call[1] + str(body) + str(params) assert compute.UrlMapReference.to_json( url_map_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_url_map_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_instances.py b/tests/unit/gapic/compute_v1/test_target_instances.py index 86dc7540f..08451015d 100644 --- a/tests/unit/gapic/compute_v1/test_target_instances.py +++ b/tests/unit/gapic/compute_v1/test_target_instances.py @@ -117,21 +117,11 @@ def test_target_instances_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetInstancesClient,]) -def test_target_instances_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetInstancesRestTransport, "rest"),], ) -def test_target_instances_client_service_account_always_use_jwt_true( +def test_target_instances_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_target_instances_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetInstancesClient,]) def test_target_instances_client_from_service_account_file(client_class): @@ -514,7 +511,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -705,9 +703,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "target_instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "target_instance_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -803,9 +802,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "target_instance_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "target_instance_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -936,13 +936,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) assert compute.TargetInstance.to_json( target_instance_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1036,8 +1037,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_pools.py b/tests/unit/gapic/compute_v1/test_target_pools.py index 5c179dccf..8ece4a9b1 100644 --- a/tests/unit/gapic/compute_v1/test_target_pools.py +++ b/tests/unit/gapic/compute_v1/test_target_pools.py @@ -114,20 +114,10 @@ def test_target_pools_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetPoolsClient,]) -def test_target_pools_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetPoolsRestTransport, "rest"),] ) -def test_target_pools_client_service_account_always_use_jwt_true( +def test_target_pools_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_target_pools_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetPoolsClient,]) def test_target_pools_client_from_service_account_file(client_class): @@ -528,14 +525,15 @@ def test_add_health_check_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.TargetPoolsAddHealthCheckRequest.to_json( target_pools_add_health_check_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_health_check_rest_flattened_error(): @@ -672,14 +670,15 @@ def test_add_instance_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.TargetPoolsAddInstanceRequest.to_json( target_pools_add_instance_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_add_instance_rest_flattened_error(): @@ -778,7 +777,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -966,9 +966,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -1068,9 +1069,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -1160,14 +1162,15 @@ def test_get_health_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.InstanceReference.to_json( instance_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_get_health_rest_flattened_error(): @@ -1299,13 +1302,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.TargetPool.to_json( target_pool_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1393,8 +1397,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1575,14 +1580,15 @@ def test_remove_health_check_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.TargetPoolsRemoveHealthCheckRequest.to_json( target_pools_remove_health_check_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_health_check_rest_flattened_error(): @@ -1719,14 +1725,15 @@ def test_remove_instance_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.TargetPoolsRemoveInstanceRequest.to_json( target_pools_remove_instance_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_remove_instance_rest_flattened_error(): @@ -1859,14 +1866,15 @@ def test_set_backup_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_pool_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_pool_value" in http_call[1] + str(body) + str(params) assert compute.TargetReference.to_json( target_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_backup_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py index 53af0816d..5360adbfb 100644 --- a/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_ssl_proxies.py @@ -118,21 +118,11 @@ def test_target_ssl_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetSslProxiesClient,]) -def test_target_ssl_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetSslProxiesRestTransport, "rest"),], ) -def test_target_ssl_proxies_client_service_account_always_use_jwt_true( +def test_target_ssl_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_target_ssl_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetSslProxiesClient,]) def test_target_ssl_proxies_client_from_service_account_file(client_class): @@ -539,8 +536,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -635,8 +633,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -765,12 +764,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.TargetSslProxy.to_json( target_ssl_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -861,7 +861,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1037,13 +1038,14 @@ def test_set_backend_service_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetSslProxiesSetBackendServiceRequest.to_json( target_ssl_proxies_set_backend_service_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_backend_service_rest_flattened_error(): @@ -1176,13 +1178,14 @@ def test_set_proxy_header_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetSslProxiesSetProxyHeaderRequest.to_json( target_ssl_proxies_set_proxy_header_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_proxy_header_rest_flattened_error(): @@ -1316,13 +1319,14 @@ def test_set_ssl_certificates_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetSslProxiesSetSslCertificatesRequest.to_json( target_ssl_proxies_set_ssl_certificates_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_ssl_certificates_rest_flattened_error(): @@ -1455,13 +1459,14 @@ def test_set_ssl_policy_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_ssl_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_ssl_proxy_value" in http_call[1] + str(body) + str(params) assert compute.SslPolicyReference.to_json( ssl_policy_reference_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_ssl_policy_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py index cb35e7ff5..6213882aa 100644 --- a/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py +++ b/tests/unit/gapic/compute_v1/test_target_tcp_proxies.py @@ -118,21 +118,11 @@ def test_target_tcp_proxies_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetTcpProxiesClient,]) -def test_target_tcp_proxies_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetTcpProxiesRestTransport, "rest"),], ) -def test_target_tcp_proxies_client_service_account_always_use_jwt_true( +def test_target_tcp_proxies_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_target_tcp_proxies_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetTcpProxiesClient,]) def test_target_tcp_proxies_client_from_service_account_file(client_class): @@ -539,8 +536,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_tcp_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_tcp_proxy_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -633,8 +631,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_tcp_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_tcp_proxy_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -763,12 +762,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.TargetTcpProxy.to_json( target_tcp_proxy_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -859,7 +859,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1035,13 +1036,14 @@ def test_set_backend_service_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_tcp_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_tcp_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetTcpProxiesSetBackendServiceRequest.to_json( target_tcp_proxies_set_backend_service_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_backend_service_rest_flattened_error(): @@ -1174,13 +1176,14 @@ def test_set_proxy_header_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "target_tcp_proxy_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "target_tcp_proxy_value" in http_call[1] + str(body) + str(params) assert compute.TargetTcpProxiesSetProxyHeaderRequest.to_json( target_tcp_proxies_set_proxy_header_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_proxy_header_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py index fd2561d55..16bbd97aa 100644 --- a/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_target_vpn_gateways.py @@ -118,21 +118,11 @@ def test_target_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [TargetVpnGatewaysClient,]) -def test_target_vpn_gateways_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.TargetVpnGatewaysRestTransport, "rest"),], ) -def test_target_vpn_gateways_client_service_account_always_use_jwt_true( +def test_target_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -142,6 +132,13 @@ def test_target_vpn_gateways_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [TargetVpnGatewaysClient,]) def test_target_vpn_gateways_client_from_service_account_file(client_class): @@ -515,7 +512,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -706,9 +704,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -808,9 +807,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "target_vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "target_vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -941,13 +941,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.TargetVpnGateway.to_json( target_vpn_gateway_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1041,8 +1042,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_url_maps.py b/tests/unit/gapic/compute_v1/test_url_maps.py index 570620b6c..bc45efef0 100644 --- a/tests/unit/gapic/compute_v1/test_url_maps.py +++ b/tests/unit/gapic/compute_v1/test_url_maps.py @@ -111,20 +111,10 @@ def test_url_maps_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [UrlMapsClient,]) -def test_url_maps_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.UrlMapsRestTransport, "rest"),] ) -def test_url_maps_client_service_account_always_use_jwt_true( +def test_url_maps_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -134,6 +124,13 @@ def test_url_maps_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [UrlMapsClient,]) def test_url_maps_client_from_service_account_file(client_class): @@ -487,7 +484,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -668,8 +666,9 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -800,8 +799,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -925,12 +925,13 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1062,13 +1063,14 @@ def test_invalidate_cache_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.CacheInvalidationRule.to_json( cache_invalidation_rule_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_invalidate_cache_rest_flattened_error(): @@ -1156,7 +1158,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1320,13 +1323,14 @@ def test_patch_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_patch_rest_flattened_error(): @@ -1455,13 +1459,14 @@ def test_update_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.UrlMap.to_json( url_map_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_update_rest_flattened_error(): @@ -1548,13 +1553,14 @@ def test_validate_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "url_map_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "url_map_value" in http_call[1] + str(body) + str(params) assert compute.UrlMapsValidateRequest.to_json( url_maps_validate_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_validate_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_vpn_gateways.py b/tests/unit/gapic/compute_v1/test_vpn_gateways.py index 2b4e33fe8..3e6f8de5a 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_gateways.py +++ b/tests/unit/gapic/compute_v1/test_vpn_gateways.py @@ -114,20 +114,10 @@ def test_vpn_gateways_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [VpnGatewaysClient,]) -def test_vpn_gateways_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.VpnGatewaysRestTransport, "rest"),] ) -def test_vpn_gateways_client_service_account_always_use_jwt_true( +def test_vpn_gateways_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_vpn_gateways_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [VpnGatewaysClient,]) def test_vpn_gateways_client_from_service_account_file(client_class): @@ -496,7 +493,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -684,9 +682,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -784,9 +783,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -878,9 +878,10 @@ def test_get_status_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "vpn_gateway_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "vpn_gateway_value" in http_call[1] + str(body) + str(params) def test_get_status_rest_flattened_error(): @@ -1011,13 +1012,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.VpnGateway.to_json( vpn_gateway_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1109,8 +1111,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -1289,14 +1292,15 @@ def test_set_labels_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.RegionSetLabelsRequest.to_json( region_set_labels_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_set_labels_rest_flattened_error(): @@ -1383,14 +1387,15 @@ def test_test_iam_permissions_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "resource_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "resource_value" in http_call[1] + str(body) + str(params) assert compute.TestPermissionsRequest.to_json( test_permissions_request_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_test_iam_permissions_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py index cb4e138d6..07634e266 100644 --- a/tests/unit/gapic/compute_v1/test_vpn_tunnels.py +++ b/tests/unit/gapic/compute_v1/test_vpn_tunnels.py @@ -114,20 +114,10 @@ def test_vpn_tunnels_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [VpnTunnelsClient,]) -def test_vpn_tunnels_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.VpnTunnelsRestTransport, "rest"),] ) -def test_vpn_tunnels_client_service_account_always_use_jwt_true( +def test_vpn_tunnels_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -137,6 +127,13 @@ def test_vpn_tunnels_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [VpnTunnelsClient,]) def test_vpn_tunnels_client_from_service_account_file(client_class): @@ -494,7 +491,8 @@ def test_aggregated_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_aggregated_list_rest_flattened_error(): @@ -679,9 +677,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "vpn_tunnel_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "vpn_tunnel_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -801,9 +800,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) - assert "vpn_tunnel_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) + assert "vpn_tunnel_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -934,13 +934,14 @@ def test_insert_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) assert compute.VpnTunnel.to_json( vpn_tunnel_resource, including_default_value_fields=False, use_integers_for_enums=False, - ) in http_call[1] + str(body) + ) in http_call[1] + str(body) + str(params) def test_insert_rest_flattened_error(): @@ -1030,8 +1031,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "region_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "region_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_zone_operations.py b/tests/unit/gapic/compute_v1/test_zone_operations.py index 17f884331..478c71c38 100644 --- a/tests/unit/gapic/compute_v1/test_zone_operations.py +++ b/tests/unit/gapic/compute_v1/test_zone_operations.py @@ -117,21 +117,11 @@ def test_zone_operations_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ZoneOperationsClient,]) -def test_zone_operations_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ZoneOperationsRestTransport, "rest"),], ) -def test_zone_operations_client_service_account_always_use_jwt_true( +def test_zone_operations_client_service_account_always_use_jwt( transport_class, transport_name ): with mock.patch.object( @@ -141,6 +131,13 @@ def test_zone_operations_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ZoneOperationsClient,]) def test_zone_operations_client_from_service_account_file(client_class): @@ -477,9 +474,10 @@ def test_delete_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_delete_rest_flattened_error(): @@ -605,9 +603,10 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -697,8 +696,9 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): @@ -863,9 +863,10 @@ def test_wait_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) - assert "operation_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) + assert "operation_value" in http_call[1] + str(body) + str(params) def test_wait_rest_flattened_error(): diff --git a/tests/unit/gapic/compute_v1/test_zones.py b/tests/unit/gapic/compute_v1/test_zones.py index 490e44f60..db3ca996b 100644 --- a/tests/unit/gapic/compute_v1/test_zones.py +++ b/tests/unit/gapic/compute_v1/test_zones.py @@ -109,22 +109,10 @@ def test_zones_client_from_service_account_info(client_class): assert client.transport._host == "compute.googleapis.com:443" -@pytest.mark.parametrize("client_class", [ZonesClient,]) -def test_zones_client_service_account_always_use_jwt(client_class): - with mock.patch.object( - service_account.Credentials, "with_always_use_jwt_access", create=True - ) as use_jwt: - creds = service_account.Credentials(None, None, None) - client = client_class(credentials=creds) - use_jwt.assert_not_called() - - @pytest.mark.parametrize( "transport_class,transport_name", [(transports.ZonesRestTransport, "rest"),] ) -def test_zones_client_service_account_always_use_jwt_true( - transport_class, transport_name -): +def test_zones_client_service_account_always_use_jwt(transport_class, transport_name): with mock.patch.object( service_account.Credentials, "with_always_use_jwt_access", create=True ) as use_jwt: @@ -132,6 +120,13 @@ def test_zones_client_service_account_always_use_jwt_true( transport = transport_class(credentials=creds, always_use_jwt_access=True) use_jwt.assert_called_once_with(True) + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + @pytest.mark.parametrize("client_class", [ZonesClient,]) def test_zones_client_from_service_account_file(client_class): @@ -483,8 +478,9 @@ def test_get_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) - assert "zone_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) + assert "zone_value" in http_call[1] + str(body) + str(params) def test_get_rest_flattened_error(): @@ -569,7 +565,8 @@ def test_list_rest_flattened(): assert len(req.mock_calls) == 1 _, http_call, http_params = req.mock_calls[0] body = http_params.get("data") - assert "project_value" in http_call[1] + str(body) + params = http_params.get("params") + assert "project_value" in http_call[1] + str(body) + str(params) def test_list_rest_flattened_error(): From 0ce21a2e4002b08c94b086a32769fb1e42370491 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Fri, 6 Aug 2021 14:58:10 +0000 Subject: [PATCH 5/5] fix: fix samples --- samples/snippets/quickstart.py | 2 +- samples/snippets/test_sample_start_stop.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/quickstart.py b/samples/snippets/quickstart.py index fb67bfab0..341217e62 100644 --- a/samples/snippets/quickstart.py +++ b/samples/snippets/quickstart.py @@ -123,7 +123,7 @@ def create_instance( initialize_params.source_image = ( source_image # "projects/debian-cloud/global/images/family/debian-10" ) - initialize_params.disk_size_gb = "10" + initialize_params.disk_size_gb = 10 disk.initialize_params = initialize_params disk.auto_delete = True disk.boot = True diff --git a/samples/snippets/test_sample_start_stop.py b/samples/snippets/test_sample_start_stop.py index ea28bfa3f..ba01dd9ee 100644 --- a/samples/snippets/test_sample_start_stop.py +++ b/samples/snippets/test_sample_start_stop.py @@ -38,7 +38,7 @@ def _make_disk(raw_key: bytes = None): initialize_params.source_image = ( "projects/debian-cloud/global/images/family/debian-10" ) - initialize_params.disk_size_gb = "10" + initialize_params.disk_size_gb = 10 disk.initialize_params = initialize_params disk.auto_delete = True disk.boot = True