From 53e5cd63e571a79b88e9fe9d3901606793d2089d Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 2 Mar 2021 07:57:51 -0800 Subject: [PATCH] chore: update gapic-generator-python to 0.40.11 PiperOrigin-RevId: 359562873 Source-Author: Google APIs Source-Date: Thu Feb 25 10:52:32 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 07932bb995e7dc91b43620ea8402c6668c7d102c Source-Link: https://github.com/googleapis/googleapis/commit/07932bb995e7dc91b43620ea8402c6668c7d102c --- .../services/cluster_manager/async_client.py | 32 +- .../services/cluster_manager/async_client.py | 32 +- synth.metadata | 4 +- tests/unit/gapic/container_v1/__init__.py | 15 + .../container_v1/test_cluster_manager.py | 550 ++++++++++++++++- .../unit/gapic/container_v1beta1/__init__.py | 15 + .../container_v1beta1/test_cluster_manager.py | 566 +++++++++++++++++- 7 files changed, 1204 insertions(+), 10 deletions(-) diff --git a/google/cloud/container_v1/services/cluster_manager/async_client.py b/google/cloud/container_v1/services/cluster_manager/async_client.py index efd24e61..57d4f93a 100644 --- a/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -73,8 +73,36 @@ class ClusterManagerAsyncClient: ClusterManagerClient.parse_common_location_path ) - from_service_account_info = ClusterManagerClient.from_service_account_info - from_service_account_file = ClusterManagerClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py index cdf13edf..404ec8a1 100644 --- a/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -77,8 +77,36 @@ class ClusterManagerAsyncClient: ClusterManagerClient.parse_common_location_path ) - from_service_account_info = ClusterManagerClient.from_service_account_info - from_service_account_file = ClusterManagerClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_info.__func__(ClusterManagerAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ClusterManagerAsyncClient: The constructed client. + """ + return ClusterManagerClient.from_service_account_file.__func__(ClusterManagerAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/synth.metadata b/synth.metadata index 18d9536a..17095a8a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5e3dacee19405529b841b53797df799c2383536c", - "internalRef": "355923884" + "sha": "07932bb995e7dc91b43620ea8402c6668c7d102c", + "internalRef": "359562873" } }, { diff --git a/tests/unit/gapic/container_v1/__init__.py b/tests/unit/gapic/container_v1/__init__.py index 8b137891..42ffdf2b 100644 --- a/tests/unit/gapic/container_v1/__init__.py +++ b/tests/unit/gapic/container_v1/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/container_v1/test_cluster_manager.py b/tests/unit/gapic/container_v1/test_cluster_manager.py index 54867bbb..c39da460 100644 --- a/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -85,15 +85,19 @@ def test__get_default_mtls_endpoint(): ) -def test_cluster_manager_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] +) +def test_cluster_manager_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = ClusterManagerClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "container.googleapis.com:443" @@ -109,9 +113,11 @@ def test_cluster_manager_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "container.googleapis.com:443" @@ -474,6 +480,22 @@ def test_list_clusters_from_dict(): test_list_clusters(request_type=dict) +def test_list_clusters_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: + client.list_clusters() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListClustersRequest() + + @pytest.mark.asyncio async def test_list_clusters_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest @@ -766,6 +788,22 @@ def test_get_cluster_from_dict(): test_get_cluster(request_type=dict) +def test_get_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: + client.get_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetClusterRequest() + + @pytest.mark.asyncio async def test_get_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest @@ -1102,6 +1140,22 @@ def test_create_cluster_from_dict(): test_create_cluster(request_type=dict) +def test_create_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: + client.create_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CreateClusterRequest() + + @pytest.mark.asyncio async def test_create_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest @@ -1387,6 +1441,22 @@ def test_update_cluster_from_dict(): test_update_cluster(request_type=dict) +def test_update_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: + client.update_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateClusterRequest() + + @pytest.mark.asyncio async def test_update_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest @@ -1692,6 +1762,22 @@ def test_update_node_pool_from_dict(): test_update_node_pool(request_type=dict) +def test_update_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_node_pool), "__call__") as call: + client.update_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateNodePoolRequest() + + @pytest.mark.asyncio async def test_update_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest @@ -1882,6 +1968,24 @@ def test_set_node_pool_autoscaling_from_dict(): test_set_node_pool_autoscaling(request_type=dict) +def test_set_node_pool_autoscaling_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), "__call__" + ) as call: + client.set_node_pool_autoscaling() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() + + @pytest.mark.asyncio async def test_set_node_pool_autoscaling_async( transport: str = "grpc_asyncio", @@ -2079,6 +2183,24 @@ def test_set_logging_service_from_dict(): test_set_logging_service(request_type=dict) +def test_set_logging_service_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), "__call__" + ) as call: + client.set_logging_service() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLoggingServiceRequest() + + @pytest.mark.asyncio async def test_set_logging_service_async( transport: str = "grpc_asyncio", @@ -2385,6 +2507,24 @@ def test_set_monitoring_service_from_dict(): test_set_monitoring_service(request_type=dict) +def test_set_monitoring_service_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), "__call__" + ) as call: + client.set_monitoring_service() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMonitoringServiceRequest() + + @pytest.mark.asyncio async def test_set_monitoring_service_async( transport: str = "grpc_asyncio", @@ -2691,6 +2831,24 @@ def test_set_addons_config_from_dict(): test_set_addons_config(request_type=dict) +def test_set_addons_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), "__call__" + ) as call: + client.set_addons_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetAddonsConfigRequest() + + @pytest.mark.asyncio async def test_set_addons_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest @@ -3006,6 +3164,22 @@ def test_set_locations_from_dict(): test_set_locations(request_type=dict) +def test_set_locations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_locations), "__call__") as call: + client.set_locations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLocationsRequest() + + @pytest.mark.asyncio async def test_set_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest @@ -3299,6 +3473,22 @@ def test_update_master_from_dict(): test_update_master(request_type=dict) +def test_update_master_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_master), "__call__") as call: + client.update_master() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateMasterRequest() + + @pytest.mark.asyncio async def test_update_master_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest @@ -3592,6 +3782,22 @@ def test_set_master_auth_from_dict(): test_set_master_auth(request_type=dict) +def test_set_master_auth_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_master_auth), "__call__") as call: + client.set_master_auth() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMasterAuthRequest() + + @pytest.mark.asyncio async def test_set_master_auth_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest @@ -3780,6 +3986,22 @@ def test_delete_cluster_from_dict(): test_delete_cluster(request_type=dict) +def test_delete_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: + client.delete_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.DeleteClusterRequest() + + @pytest.mark.asyncio async def test_delete_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest @@ -4035,6 +4257,22 @@ def test_list_operations_from_dict(): test_list_operations(request_type=dict) +def test_list_operations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + client.list_operations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListOperationsRequest() + + @pytest.mark.asyncio async def test_list_operations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest @@ -4272,6 +4510,22 @@ def test_get_operation_from_dict(): test_get_operation(request_type=dict) +def test_get_operation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + client.get_operation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetOperationRequest() + + @pytest.mark.asyncio async def test_get_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest @@ -4522,6 +4776,22 @@ def test_cancel_operation_from_dict(): test_cancel_operation(request_type=dict) +def test_cancel_operation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + client.cancel_operation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CancelOperationRequest() + + @pytest.mark.asyncio async def test_cancel_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest @@ -4751,6 +5021,24 @@ def test_get_server_config_from_dict(): test_get_server_config(request_type=dict) +def test_get_server_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), "__call__" + ) as call: + client.get_server_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetServerConfigRequest() + + @pytest.mark.asyncio async def test_get_server_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest @@ -4984,6 +5272,24 @@ def test_get_json_web_keys_from_dict(): test_get_json_web_keys(request_type=dict) +def test_get_json_web_keys_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), "__call__" + ) as call: + client.get_json_web_keys() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetJSONWebKeysRequest() + + @pytest.mark.asyncio async def test_get_json_web_keys_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest @@ -5110,6 +5416,22 @@ def test_list_node_pools_from_dict(): test_list_node_pools(request_type=dict) +def test_list_node_pools_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: + client.list_node_pools() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListNodePoolsRequest() + + @pytest.mark.asyncio async def test_list_node_pools_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest @@ -5355,6 +5677,22 @@ def test_get_node_pool_from_dict(): test_get_node_pool(request_type=dict) +def test_get_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: + client.get_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetNodePoolRequest() + + @pytest.mark.asyncio async def test_get_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest @@ -5642,6 +5980,22 @@ def test_create_node_pool_from_dict(): test_create_node_pool(request_type=dict) +def test_create_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: + client.create_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CreateNodePoolRequest() + + @pytest.mark.asyncio async def test_create_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest @@ -5935,6 +6289,22 @@ def test_delete_node_pool_from_dict(): test_delete_node_pool(request_type=dict) +def test_delete_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: + client.delete_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.DeleteNodePoolRequest() + + @pytest.mark.asyncio async def test_delete_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest @@ -6230,6 +6600,24 @@ def test_rollback_node_pool_upgrade_from_dict(): test_rollback_node_pool_upgrade(request_type=dict) +def test_rollback_node_pool_upgrade_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), "__call__" + ) as call: + client.rollback_node_pool_upgrade() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() + + @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_async( transport: str = "grpc_asyncio", @@ -6536,6 +6924,24 @@ def test_set_node_pool_management_from_dict(): test_set_node_pool_management(request_type=dict) +def test_set_node_pool_management_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), "__call__" + ) as call: + client.set_node_pool_management() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolManagementRequest() + + @pytest.mark.asyncio async def test_set_node_pool_management_async( transport: str = "grpc_asyncio", @@ -6731,6 +7137,22 @@ def test_set_labels_from_dict(): test_set_labels(request_type=dict) +def test_set_labels_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_labels), "__call__") as call: + client.set_labels() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLabelsRequest() + + @pytest.mark.asyncio async def test_set_labels_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest @@ -6919,6 +7341,22 @@ def test_set_legacy_abac_from_dict(): test_set_legacy_abac(request_type=dict) +def test_set_legacy_abac_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: + client.set_legacy_abac() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLegacyAbacRequest() + + @pytest.mark.asyncio async def test_set_legacy_abac_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest @@ -7214,6 +7652,24 @@ def test_start_ip_rotation_from_dict(): test_start_ip_rotation(request_type=dict) +def test_start_ip_rotation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), "__call__" + ) as call: + client.start_ip_rotation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.StartIPRotationRequest() + + @pytest.mark.asyncio async def test_start_ip_rotation_async( transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest @@ -7511,6 +7967,24 @@ def test_complete_ip_rotation_from_dict(): test_complete_ip_rotation(request_type=dict) +def test_complete_ip_rotation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), "__call__" + ) as call: + client.complete_ip_rotation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CompleteIPRotationRequest() + + @pytest.mark.asyncio async def test_complete_ip_rotation_async( transport: str = "grpc_asyncio", @@ -7809,6 +8283,24 @@ def test_set_node_pool_size_from_dict(): test_set_node_pool_size(request_type=dict) +def test_set_node_pool_size_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), "__call__" + ) as call: + client.set_node_pool_size() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolSizeRequest() + + @pytest.mark.asyncio async def test_set_node_pool_size_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest @@ -8005,6 +8497,24 @@ def test_set_network_policy_from_dict(): test_set_network_policy(request_type=dict) +def test_set_network_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), "__call__" + ) as call: + client.set_network_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNetworkPolicyRequest() + + @pytest.mark.asyncio async def test_set_network_policy_async( transport: str = "grpc_asyncio", @@ -8323,6 +8833,24 @@ def test_set_maintenance_policy_from_dict(): test_set_maintenance_policy(request_type=dict) +def test_set_maintenance_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), "__call__" + ) as call: + client.set_maintenance_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMaintenancePolicyRequest() + + @pytest.mark.asyncio async def test_set_maintenance_policy_async( transport: str = "grpc_asyncio", @@ -8635,6 +9163,24 @@ def test_list_usable_subnetworks_from_dict(): test_list_usable_subnetworks(request_type=dict) +def test_list_usable_subnetworks_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), "__call__" + ) as call: + client.list_usable_subnetworks() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListUsableSubnetworksRequest() + + @pytest.mark.asyncio async def test_list_usable_subnetworks_async( transport: str = "grpc_asyncio", diff --git a/tests/unit/gapic/container_v1beta1/__init__.py b/tests/unit/gapic/container_v1beta1/__init__.py index 8b137891..42ffdf2b 100644 --- a/tests/unit/gapic/container_v1beta1/__init__.py +++ b/tests/unit/gapic/container_v1beta1/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index 6a070c4a..20a19f37 100644 --- a/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -90,15 +90,19 @@ def test__get_default_mtls_endpoint(): ) -def test_cluster_manager_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [ClusterManagerClient, ClusterManagerAsyncClient,] +) +def test_cluster_manager_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = ClusterManagerClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "container.googleapis.com:443" @@ -114,9 +118,11 @@ def test_cluster_manager_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "container.googleapis.com:443" @@ -479,6 +485,22 @@ def test_list_clusters_from_dict(): test_list_clusters(request_type=dict) +def test_list_clusters_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_clusters), "__call__") as call: + client.list_clusters() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListClustersRequest() + + @pytest.mark.asyncio async def test_list_clusters_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListClustersRequest @@ -771,6 +793,22 @@ def test_get_cluster_from_dict(): test_get_cluster(request_type=dict) +def test_get_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_cluster), "__call__") as call: + client.get_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetClusterRequest() + + @pytest.mark.asyncio async def test_get_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetClusterRequest @@ -1105,6 +1143,22 @@ def test_create_cluster_from_dict(): test_create_cluster(request_type=dict) +def test_create_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_cluster), "__call__") as call: + client.create_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CreateClusterRequest() + + @pytest.mark.asyncio async def test_create_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateClusterRequest @@ -1382,6 +1436,22 @@ def test_update_cluster_from_dict(): test_update_cluster(request_type=dict) +def test_update_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_cluster), "__call__") as call: + client.update_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateClusterRequest() + + @pytest.mark.asyncio async def test_update_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateClusterRequest @@ -1679,6 +1749,22 @@ def test_update_node_pool_from_dict(): test_update_node_pool(request_type=dict) +def test_update_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_node_pool), "__call__") as call: + client.update_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateNodePoolRequest() + + @pytest.mark.asyncio async def test_update_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateNodePoolRequest @@ -1869,6 +1955,24 @@ def test_set_node_pool_autoscaling_from_dict(): test_set_node_pool_autoscaling(request_type=dict) +def test_set_node_pool_autoscaling_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_autoscaling), "__call__" + ) as call: + client.set_node_pool_autoscaling() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolAutoscalingRequest() + + @pytest.mark.asyncio async def test_set_node_pool_autoscaling_async( transport: str = "grpc_asyncio", @@ -2066,6 +2170,24 @@ def test_set_logging_service_from_dict(): test_set_logging_service(request_type=dict) +def test_set_logging_service_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_logging_service), "__call__" + ) as call: + client.set_logging_service() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLoggingServiceRequest() + + @pytest.mark.asyncio async def test_set_logging_service_async( transport: str = "grpc_asyncio", @@ -2364,6 +2486,24 @@ def test_set_monitoring_service_from_dict(): test_set_monitoring_service(request_type=dict) +def test_set_monitoring_service_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_monitoring_service), "__call__" + ) as call: + client.set_monitoring_service() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMonitoringServiceRequest() + + @pytest.mark.asyncio async def test_set_monitoring_service_async( transport: str = "grpc_asyncio", @@ -2662,6 +2802,24 @@ def test_set_addons_config_from_dict(): test_set_addons_config(request_type=dict) +def test_set_addons_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_addons_config), "__call__" + ) as call: + client.set_addons_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetAddonsConfigRequest() + + @pytest.mark.asyncio async def test_set_addons_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetAddonsConfigRequest @@ -2969,6 +3127,22 @@ def test_set_locations_from_dict(): test_set_locations(request_type=dict) +def test_set_locations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_locations), "__call__") as call: + client.set_locations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLocationsRequest() + + @pytest.mark.asyncio async def test_set_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLocationsRequest @@ -3254,6 +3428,22 @@ def test_update_master_from_dict(): test_update_master(request_type=dict) +def test_update_master_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_master), "__call__") as call: + client.update_master() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.UpdateMasterRequest() + + @pytest.mark.asyncio async def test_update_master_async( transport: str = "grpc_asyncio", request_type=cluster_service.UpdateMasterRequest @@ -3539,6 +3729,22 @@ def test_set_master_auth_from_dict(): test_set_master_auth(request_type=dict) +def test_set_master_auth_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_master_auth), "__call__") as call: + client.set_master_auth() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMasterAuthRequest() + + @pytest.mark.asyncio async def test_set_master_auth_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetMasterAuthRequest @@ -3727,6 +3933,22 @@ def test_delete_cluster_from_dict(): test_delete_cluster(request_type=dict) +def test_delete_cluster_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_cluster), "__call__") as call: + client.delete_cluster() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.DeleteClusterRequest() + + @pytest.mark.asyncio async def test_delete_cluster_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteClusterRequest @@ -3974,6 +4196,22 @@ def test_list_operations_from_dict(): test_list_operations(request_type=dict) +def test_list_operations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_operations), "__call__") as call: + client.list_operations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListOperationsRequest() + + @pytest.mark.asyncio async def test_list_operations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListOperationsRequest @@ -4211,6 +4449,22 @@ def test_get_operation_from_dict(): test_get_operation(request_type=dict) +def test_get_operation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_operation), "__call__") as call: + client.get_operation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetOperationRequest() + + @pytest.mark.asyncio async def test_get_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetOperationRequest @@ -4453,6 +4707,22 @@ def test_cancel_operation_from_dict(): test_cancel_operation(request_type=dict) +def test_cancel_operation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.cancel_operation), "__call__") as call: + client.cancel_operation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CancelOperationRequest() + + @pytest.mark.asyncio async def test_cancel_operation_async( transport: str = "grpc_asyncio", request_type=cluster_service.CancelOperationRequest @@ -4674,6 +4944,24 @@ def test_get_server_config_from_dict(): test_get_server_config(request_type=dict) +def test_get_server_config_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_server_config), "__call__" + ) as call: + client.get_server_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetServerConfigRequest() + + @pytest.mark.asyncio async def test_get_server_config_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetServerConfigRequest @@ -4899,6 +5187,22 @@ def test_list_node_pools_from_dict(): test_list_node_pools(request_type=dict) +def test_list_node_pools_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_node_pools), "__call__") as call: + client.list_node_pools() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListNodePoolsRequest() + + @pytest.mark.asyncio async def test_list_node_pools_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListNodePoolsRequest @@ -5110,6 +5414,24 @@ def test_get_json_web_keys_from_dict(): test_get_json_web_keys(request_type=dict) +def test_get_json_web_keys_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_json_web_keys), "__call__" + ) as call: + client.get_json_web_keys() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetJSONWebKeysRequest() + + @pytest.mark.asyncio async def test_get_json_web_keys_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetJSONWebKeysRequest @@ -5264,6 +5586,22 @@ def test_get_node_pool_from_dict(): test_get_node_pool(request_type=dict) +def test_get_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_node_pool), "__call__") as call: + client.get_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.GetNodePoolRequest() + + @pytest.mark.asyncio async def test_get_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.GetNodePoolRequest @@ -5543,6 +5881,22 @@ def test_create_node_pool_from_dict(): test_create_node_pool(request_type=dict) +def test_create_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_node_pool), "__call__") as call: + client.create_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CreateNodePoolRequest() + + @pytest.mark.asyncio async def test_create_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.CreateNodePoolRequest @@ -5828,6 +6182,22 @@ def test_delete_node_pool_from_dict(): test_delete_node_pool(request_type=dict) +def test_delete_node_pool_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_node_pool), "__call__") as call: + client.delete_node_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.DeleteNodePoolRequest() + + @pytest.mark.asyncio async def test_delete_node_pool_async( transport: str = "grpc_asyncio", request_type=cluster_service.DeleteNodePoolRequest @@ -6115,6 +6485,24 @@ def test_rollback_node_pool_upgrade_from_dict(): test_rollback_node_pool_upgrade(request_type=dict) +def test_rollback_node_pool_upgrade_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.rollback_node_pool_upgrade), "__call__" + ) as call: + client.rollback_node_pool_upgrade() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.RollbackNodePoolUpgradeRequest() + + @pytest.mark.asyncio async def test_rollback_node_pool_upgrade_async( transport: str = "grpc_asyncio", @@ -6413,6 +6801,24 @@ def test_set_node_pool_management_from_dict(): test_set_node_pool_management(request_type=dict) +def test_set_node_pool_management_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_management), "__call__" + ) as call: + client.set_node_pool_management() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolManagementRequest() + + @pytest.mark.asyncio async def test_set_node_pool_management_async( transport: str = "grpc_asyncio", @@ -6717,6 +7123,22 @@ def test_set_labels_from_dict(): test_set_labels(request_type=dict) +def test_set_labels_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_labels), "__call__") as call: + client.set_labels() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLabelsRequest() + + @pytest.mark.asyncio async def test_set_labels_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLabelsRequest @@ -7010,6 +7432,22 @@ def test_set_legacy_abac_from_dict(): test_set_legacy_abac(request_type=dict) +def test_set_legacy_abac_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_legacy_abac), "__call__") as call: + client.set_legacy_abac() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetLegacyAbacRequest() + + @pytest.mark.asyncio async def test_set_legacy_abac_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetLegacyAbacRequest @@ -7297,6 +7735,24 @@ def test_start_ip_rotation_from_dict(): test_start_ip_rotation(request_type=dict) +def test_start_ip_rotation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.start_ip_rotation), "__call__" + ) as call: + client.start_ip_rotation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.StartIPRotationRequest() + + @pytest.mark.asyncio async def test_start_ip_rotation_async( transport: str = "grpc_asyncio", request_type=cluster_service.StartIPRotationRequest @@ -7586,6 +8042,24 @@ def test_complete_ip_rotation_from_dict(): test_complete_ip_rotation(request_type=dict) +def test_complete_ip_rotation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_ip_rotation), "__call__" + ) as call: + client.complete_ip_rotation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.CompleteIPRotationRequest() + + @pytest.mark.asyncio async def test_complete_ip_rotation_async( transport: str = "grpc_asyncio", @@ -7876,6 +8350,24 @@ def test_set_node_pool_size_from_dict(): test_set_node_pool_size(request_type=dict) +def test_set_node_pool_size_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_node_pool_size), "__call__" + ) as call: + client.set_node_pool_size() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNodePoolSizeRequest() + + @pytest.mark.asyncio async def test_set_node_pool_size_async( transport: str = "grpc_asyncio", request_type=cluster_service.SetNodePoolSizeRequest @@ -8072,6 +8564,24 @@ def test_set_network_policy_from_dict(): test_set_network_policy(request_type=dict) +def test_set_network_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_network_policy), "__call__" + ) as call: + client.set_network_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetNetworkPolicyRequest() + + @pytest.mark.asyncio async def test_set_network_policy_async( transport: str = "grpc_asyncio", @@ -8382,6 +8892,24 @@ def test_set_maintenance_policy_from_dict(): test_set_maintenance_policy(request_type=dict) +def test_set_maintenance_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.set_maintenance_policy), "__call__" + ) as call: + client.set_maintenance_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.SetMaintenancePolicyRequest() + + @pytest.mark.asyncio async def test_set_maintenance_policy_async( transport: str = "grpc_asyncio", @@ -8686,6 +9214,24 @@ def test_list_usable_subnetworks_from_dict(): test_list_usable_subnetworks(request_type=dict) +def test_list_usable_subnetworks_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_usable_subnetworks), "__call__" + ) as call: + client.list_usable_subnetworks() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListUsableSubnetworksRequest() + + @pytest.mark.asyncio async def test_list_usable_subnetworks_async( transport: str = "grpc_asyncio", @@ -9064,6 +9610,22 @@ def test_list_locations_from_dict(): test_list_locations(request_type=dict) +def test_list_locations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_locations), "__call__") as call: + client.list_locations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == cluster_service.ListLocationsRequest() + + @pytest.mark.asyncio async def test_list_locations_async( transport: str = "grpc_asyncio", request_type=cluster_service.ListLocationsRequest