diff --git a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 index ccd963ffbd..d76cd91a82 100644 --- a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 +++ b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 @@ -1466,14 +1466,20 @@ def test_{{ method_name }}_rest_no_http_options(): @pytest.mark.asyncio {% endif %}{# is_async #} {{ async_method_prefix }}def test_{{ method_name }}_{{ test_name }}_{{transport_name}}(): + {% if transport_name == 'rest_asyncio' %} + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + {% endif %} client = {{ get_client(service=service, is_async=is_async) }}( credentials={{ get_credentials(is_async=is_async) }}, + transport="{{ transport_name }}", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.{{ method.transport_safe_name|snake_case }}), '__call__') as call: + {% if 'rest' not in transport %} {% if is_async %} # Designate an appropriate return value for the call. {% if method.void %} @@ -1498,7 +1504,6 @@ def test_{{ method_name }}_rest_no_http_options(): {% endfor %} )) {% endif %}{# method.void #} - await client.{{ method_name }}(request={{ request_dict }}) {% else %}{# if not is_async #} {% if method.void %} call.return_value = None @@ -1509,10 +1514,15 @@ def test_{{ method_name }}_rest_no_http_options(): {% else %} call.return_value = {{ method.output.ident }}() {% endif %} + {% endif %}{# is_async #} + {% endif %}{# if 'rest' not in transport #} + {% if is_async %} + await client.{{ method_name }}(request={{ request_dict }}) + {% else %}{# is_async #} client.{{ method_name }}(request={{ request_dict }}) {% endif %}{# is_async #} - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, {% if routing_param %}kw{% else %}_{% endif %} = call.mock_calls[0] {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} @@ -2142,11 +2152,6 @@ def test_initialize_client_w_{{transport_name}}(): {% endmacro %}{# call_success_mixins_test #} {% macro empty_call_test(service, api, transport, is_async) %} -{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2159): - Currently this macro only supports gRPC. It should be updated to support REST - transport as well. -#} -{% if 'rest' not in transport %} {% for method in service.methods.values() %}{# method #} {% if not method.client_streaming %} # This test is a coverage failsafe to make sure that totally empty calls, @@ -2154,7 +2159,6 @@ def test_initialize_client_w_{{transport_name}}(): {{ method_call_test_generic("empty_call", method, service, api, transport, request_dict=None, is_async=is_async) }} {% endif %}{# not method.client_streaming #} {% endfor %}{# method in service.methods.values() #} -{% endif %}{# 'rest' not in transport #} {% endmacro %}{# empty_call_test #} {% macro get_uuid4_re() -%} @@ -2162,11 +2166,6 @@ def test_initialize_client_w_{{transport_name}}(): {%- endmacro %}{# uuid_re #} {% macro routing_parameter_test(service, api, transport, is_async) %} -{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2159): - Currently this macro only supports gRPC. It should be updated to support REST - transport as well. -#} -{% if 'rest' not in transport %} {% for method in service.methods.values() %}{# method #} {% if method.explicit_routing %} {# Any value that is part of the HTTP/1.1 URI should be sent as #} @@ -2176,7 +2175,6 @@ def test_initialize_client_w_{{transport_name}}(): {% endfor %}{# routing_param in method.routing_rule.routing_parameters #} {% endif %}{# method.explicit_routing #} {% endfor %}{# method in service.methods.values() #} -{% endif %} {% endmacro %}{# routing_parameter_test #} {# inteceptor_class_test generates tests for rest interceptors. #} @@ -2269,4 +2267,4 @@ def test_initialize_client_w_{{transport_name}}(): post.assert_called_once() {% endif %} {% endif %}{# end 'grpc' in transport #} -{% endmacro%} +{% endmacro%}{# inteceptor_class_test #} diff --git a/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py b/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py index 1e304113db..fcf9a01fbc 100755 --- a/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py +++ b/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py @@ -12971,16 +12971,17 @@ def test_initialize_client_w_grpc(): def test_export_assets_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.export_assets), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.export_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() @@ -12993,16 +12994,17 @@ def test_export_assets_empty_call_grpc(): def test_list_assets_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_assets), '__call__') as call: call.return_value = asset_service.ListAssetsResponse() client.list_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() @@ -13015,16 +13017,17 @@ def test_list_assets_empty_call_grpc(): def test_batch_get_assets_history_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.batch_get_assets_history), '__call__') as call: call.return_value = asset_service.BatchGetAssetsHistoryResponse() client.batch_get_assets_history(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() @@ -13037,16 +13040,17 @@ def test_batch_get_assets_history_empty_call_grpc(): def test_create_feed_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_feed), '__call__') as call: call.return_value = asset_service.Feed() client.create_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() @@ -13059,16 +13063,17 @@ def test_create_feed_empty_call_grpc(): def test_get_feed_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_feed), '__call__') as call: call.return_value = asset_service.Feed() client.get_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() @@ -13081,16 +13086,17 @@ def test_get_feed_empty_call_grpc(): def test_list_feeds_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_feeds), '__call__') as call: call.return_value = asset_service.ListFeedsResponse() client.list_feeds(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() @@ -13103,16 +13109,17 @@ def test_list_feeds_empty_call_grpc(): def test_update_feed_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_feed), '__call__') as call: call.return_value = asset_service.Feed() client.update_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() @@ -13125,16 +13132,17 @@ def test_update_feed_empty_call_grpc(): def test_delete_feed_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_feed), '__call__') as call: call.return_value = None client.delete_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() @@ -13147,16 +13155,17 @@ def test_delete_feed_empty_call_grpc(): def test_search_all_resources_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.search_all_resources), '__call__') as call: call.return_value = asset_service.SearchAllResourcesResponse() client.search_all_resources(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() @@ -13169,16 +13178,17 @@ def test_search_all_resources_empty_call_grpc(): def test_search_all_iam_policies_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.search_all_iam_policies), '__call__') as call: call.return_value = asset_service.SearchAllIamPoliciesResponse() client.search_all_iam_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() @@ -13191,16 +13201,17 @@ def test_search_all_iam_policies_empty_call_grpc(): def test_analyze_iam_policy_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_iam_policy), '__call__') as call: call.return_value = asset_service.AnalyzeIamPolicyResponse() client.analyze_iam_policy(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() @@ -13213,16 +13224,17 @@ def test_analyze_iam_policy_empty_call_grpc(): def test_analyze_iam_policy_longrunning_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_iam_policy_longrunning), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.analyze_iam_policy_longrunning(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() @@ -13235,16 +13247,17 @@ def test_analyze_iam_policy_longrunning_empty_call_grpc(): def test_analyze_move_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_move), '__call__') as call: call.return_value = asset_service.AnalyzeMoveResponse() client.analyze_move(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() @@ -13257,16 +13270,17 @@ def test_analyze_move_empty_call_grpc(): def test_query_assets_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.query_assets), '__call__') as call: call.return_value = asset_service.QueryAssetsResponse() client.query_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() @@ -13279,16 +13293,17 @@ def test_query_assets_empty_call_grpc(): def test_create_saved_query_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_saved_query), '__call__') as call: call.return_value = asset_service.SavedQuery() client.create_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() @@ -13301,16 +13316,17 @@ def test_create_saved_query_empty_call_grpc(): def test_get_saved_query_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_saved_query), '__call__') as call: call.return_value = asset_service.SavedQuery() client.get_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() @@ -13323,16 +13339,17 @@ def test_get_saved_query_empty_call_grpc(): def test_list_saved_queries_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_saved_queries), '__call__') as call: call.return_value = asset_service.ListSavedQueriesResponse() client.list_saved_queries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() @@ -13345,16 +13362,17 @@ def test_list_saved_queries_empty_call_grpc(): def test_update_saved_query_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_saved_query), '__call__') as call: call.return_value = asset_service.SavedQuery() client.update_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() @@ -13367,16 +13385,17 @@ def test_update_saved_query_empty_call_grpc(): def test_delete_saved_query_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_saved_query), '__call__') as call: call.return_value = None client.delete_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() @@ -13389,16 +13408,17 @@ def test_delete_saved_query_empty_call_grpc(): def test_batch_get_effective_iam_policies_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.batch_get_effective_iam_policies), '__call__') as call: call.return_value = asset_service.BatchGetEffectiveIamPoliciesResponse() client.batch_get_effective_iam_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() @@ -13411,16 +13431,17 @@ def test_batch_get_effective_iam_policies_empty_call_grpc(): def test_analyze_org_policies_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policies), '__call__') as call: call.return_value = asset_service.AnalyzeOrgPoliciesResponse() client.analyze_org_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() @@ -13433,16 +13454,17 @@ def test_analyze_org_policies_empty_call_grpc(): def test_analyze_org_policy_governed_containers_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policy_governed_containers), '__call__') as call: call.return_value = asset_service.AnalyzeOrgPolicyGovernedContainersResponse() client.analyze_org_policy_governed_containers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() @@ -13455,16 +13477,17 @@ def test_analyze_org_policy_governed_containers_empty_call_grpc(): def test_analyze_org_policy_governed_assets_empty_call_grpc(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policy_governed_assets), '__call__') as call: call.return_value = asset_service.AnalyzeOrgPolicyGovernedAssetsResponse() client.analyze_org_policy_governed_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() @@ -13493,9 +13516,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_export_assets_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.export_assets), '__call__') as call: @@ -13505,7 +13529,7 @@ async def test_export_assets_empty_call_grpc_asyncio(): ) await client.export_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ExportAssetsRequest() @@ -13519,9 +13543,10 @@ async def test_export_assets_empty_call_grpc_asyncio(): async def test_list_assets_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_assets), '__call__') as call: @@ -13531,7 +13556,7 @@ async def test_list_assets_empty_call_grpc_asyncio(): )) await client.list_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListAssetsRequest() @@ -13545,9 +13570,10 @@ async def test_list_assets_empty_call_grpc_asyncio(): async def test_batch_get_assets_history_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.batch_get_assets_history), '__call__') as call: @@ -13556,7 +13582,7 @@ async def test_batch_get_assets_history_empty_call_grpc_asyncio(): )) await client.batch_get_assets_history(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetAssetsHistoryRequest() @@ -13570,9 +13596,10 @@ async def test_batch_get_assets_history_empty_call_grpc_asyncio(): async def test_create_feed_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_feed), '__call__') as call: @@ -13586,7 +13613,7 @@ async def test_create_feed_empty_call_grpc_asyncio(): )) await client.create_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateFeedRequest() @@ -13600,9 +13627,10 @@ async def test_create_feed_empty_call_grpc_asyncio(): async def test_get_feed_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_feed), '__call__') as call: @@ -13616,7 +13644,7 @@ async def test_get_feed_empty_call_grpc_asyncio(): )) await client.get_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetFeedRequest() @@ -13630,9 +13658,10 @@ async def test_get_feed_empty_call_grpc_asyncio(): async def test_list_feeds_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_feeds), '__call__') as call: @@ -13641,7 +13670,7 @@ async def test_list_feeds_empty_call_grpc_asyncio(): )) await client.list_feeds(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListFeedsRequest() @@ -13655,9 +13684,10 @@ async def test_list_feeds_empty_call_grpc_asyncio(): async def test_update_feed_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_feed), '__call__') as call: @@ -13671,7 +13701,7 @@ async def test_update_feed_empty_call_grpc_asyncio(): )) await client.update_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateFeedRequest() @@ -13685,9 +13715,10 @@ async def test_update_feed_empty_call_grpc_asyncio(): async def test_delete_feed_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_feed), '__call__') as call: @@ -13695,7 +13726,7 @@ async def test_delete_feed_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_feed(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteFeedRequest() @@ -13709,9 +13740,10 @@ async def test_delete_feed_empty_call_grpc_asyncio(): async def test_search_all_resources_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.search_all_resources), '__call__') as call: @@ -13721,7 +13753,7 @@ async def test_search_all_resources_empty_call_grpc_asyncio(): )) await client.search_all_resources(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllResourcesRequest() @@ -13735,9 +13767,10 @@ async def test_search_all_resources_empty_call_grpc_asyncio(): async def test_search_all_iam_policies_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.search_all_iam_policies), '__call__') as call: @@ -13747,7 +13780,7 @@ async def test_search_all_iam_policies_empty_call_grpc_asyncio(): )) await client.search_all_iam_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.SearchAllIamPoliciesRequest() @@ -13761,9 +13794,10 @@ async def test_search_all_iam_policies_empty_call_grpc_asyncio(): async def test_analyze_iam_policy_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_iam_policy), '__call__') as call: @@ -13773,7 +13807,7 @@ async def test_analyze_iam_policy_empty_call_grpc_asyncio(): )) await client.analyze_iam_policy(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyRequest() @@ -13787,9 +13821,10 @@ async def test_analyze_iam_policy_empty_call_grpc_asyncio(): async def test_analyze_iam_policy_longrunning_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_iam_policy_longrunning), '__call__') as call: @@ -13799,7 +13834,7 @@ async def test_analyze_iam_policy_longrunning_empty_call_grpc_asyncio(): ) await client.analyze_iam_policy_longrunning(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() @@ -13813,9 +13848,10 @@ async def test_analyze_iam_policy_longrunning_empty_call_grpc_asyncio(): async def test_analyze_move_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_move), '__call__') as call: @@ -13824,7 +13860,7 @@ async def test_analyze_move_empty_call_grpc_asyncio(): )) await client.analyze_move(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeMoveRequest() @@ -13838,9 +13874,10 @@ async def test_analyze_move_empty_call_grpc_asyncio(): async def test_query_assets_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.query_assets), '__call__') as call: @@ -13851,7 +13888,7 @@ async def test_query_assets_empty_call_grpc_asyncio(): )) await client.query_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.QueryAssetsRequest() @@ -13865,9 +13902,10 @@ async def test_query_assets_empty_call_grpc_asyncio(): async def test_create_saved_query_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_saved_query), '__call__') as call: @@ -13880,7 +13918,7 @@ async def test_create_saved_query_empty_call_grpc_asyncio(): )) await client.create_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.CreateSavedQueryRequest() @@ -13894,9 +13932,10 @@ async def test_create_saved_query_empty_call_grpc_asyncio(): async def test_get_saved_query_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_saved_query), '__call__') as call: @@ -13909,7 +13948,7 @@ async def test_get_saved_query_empty_call_grpc_asyncio(): )) await client.get_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.GetSavedQueryRequest() @@ -13923,9 +13962,10 @@ async def test_get_saved_query_empty_call_grpc_asyncio(): async def test_list_saved_queries_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_saved_queries), '__call__') as call: @@ -13935,7 +13975,7 @@ async def test_list_saved_queries_empty_call_grpc_asyncio(): )) await client.list_saved_queries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.ListSavedQueriesRequest() @@ -13949,9 +13989,10 @@ async def test_list_saved_queries_empty_call_grpc_asyncio(): async def test_update_saved_query_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_saved_query), '__call__') as call: @@ -13964,7 +14005,7 @@ async def test_update_saved_query_empty_call_grpc_asyncio(): )) await client.update_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.UpdateSavedQueryRequest() @@ -13978,9 +14019,10 @@ async def test_update_saved_query_empty_call_grpc_asyncio(): async def test_delete_saved_query_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_saved_query), '__call__') as call: @@ -13988,7 +14030,7 @@ async def test_delete_saved_query_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_saved_query(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.DeleteSavedQueryRequest() @@ -14002,9 +14044,10 @@ async def test_delete_saved_query_empty_call_grpc_asyncio(): async def test_batch_get_effective_iam_policies_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.batch_get_effective_iam_policies), '__call__') as call: @@ -14013,7 +14056,7 @@ async def test_batch_get_effective_iam_policies_empty_call_grpc_asyncio(): )) await client.batch_get_effective_iam_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() @@ -14027,9 +14070,10 @@ async def test_batch_get_effective_iam_policies_empty_call_grpc_asyncio(): async def test_analyze_org_policies_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policies), '__call__') as call: @@ -14039,7 +14083,7 @@ async def test_analyze_org_policies_empty_call_grpc_asyncio(): )) await client.analyze_org_policies(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPoliciesRequest() @@ -14053,9 +14097,10 @@ async def test_analyze_org_policies_empty_call_grpc_asyncio(): async def test_analyze_org_policy_governed_containers_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policy_governed_containers), '__call__') as call: @@ -14065,7 +14110,7 @@ async def test_analyze_org_policy_governed_containers_empty_call_grpc_asyncio(): )) await client.analyze_org_policy_governed_containers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() @@ -14079,9 +14124,10 @@ async def test_analyze_org_policy_governed_containers_empty_call_grpc_asyncio(): async def test_analyze_org_policy_governed_assets_empty_call_grpc_asyncio(): client = AssetServiceAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.analyze_org_policy_governed_assets), '__call__') as call: @@ -14091,7 +14137,7 @@ async def test_analyze_org_policy_governed_assets_empty_call_grpc_asyncio(): )) await client.analyze_org_policy_governed_assets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() @@ -16571,6 +16617,512 @@ def test_initialize_client_w_rest(): assert client is not None +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_export_assets_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.export_assets), + '__call__') as call: + client.export_assets(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.ExportAssetsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_assets_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_assets), + '__call__') as call: + client.list_assets(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.ListAssetsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_batch_get_assets_history_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.batch_get_assets_history), + '__call__') as call: + client.batch_get_assets_history(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.BatchGetAssetsHistoryRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_feed_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_feed), + '__call__') as call: + client.create_feed(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.CreateFeedRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_feed_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_feed), + '__call__') as call: + client.get_feed(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.GetFeedRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_feeds_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_feeds), + '__call__') as call: + client.list_feeds(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.ListFeedsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_feed_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_feed), + '__call__') as call: + client.update_feed(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.UpdateFeedRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_feed_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_feed), + '__call__') as call: + client.delete_feed(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.DeleteFeedRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_search_all_resources_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.search_all_resources), + '__call__') as call: + client.search_all_resources(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.SearchAllResourcesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_search_all_iam_policies_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.search_all_iam_policies), + '__call__') as call: + client.search_all_iam_policies(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.SearchAllIamPoliciesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_iam_policy_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy), + '__call__') as call: + client.analyze_iam_policy(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeIamPolicyRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_iam_policy_longrunning_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy_longrunning), + '__call__') as call: + client.analyze_iam_policy_longrunning(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeIamPolicyLongrunningRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_move_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_move), + '__call__') as call: + client.analyze_move(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeMoveRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_query_assets_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.query_assets), + '__call__') as call: + client.query_assets(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.QueryAssetsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_saved_query_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_saved_query), + '__call__') as call: + client.create_saved_query(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.CreateSavedQueryRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_saved_query_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_saved_query), + '__call__') as call: + client.get_saved_query(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.GetSavedQueryRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_saved_queries_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_saved_queries), + '__call__') as call: + client.list_saved_queries(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.ListSavedQueriesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_saved_query_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_saved_query), + '__call__') as call: + client.update_saved_query(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.UpdateSavedQueryRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_saved_query_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_saved_query), + '__call__') as call: + client.delete_saved_query(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.DeleteSavedQueryRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_batch_get_effective_iam_policies_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.batch_get_effective_iam_policies), + '__call__') as call: + client.batch_get_effective_iam_policies(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.BatchGetEffectiveIamPoliciesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_org_policies_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policies), + '__call__') as call: + client.analyze_org_policies(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeOrgPoliciesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_org_policy_governed_containers_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policy_governed_containers), + '__call__') as call: + client.analyze_org_policy_governed_containers(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_analyze_org_policy_governed_assets_empty_call_rest(): + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policy_governed_assets), + '__call__') as call: + client.analyze_org_policy_governed_assets(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + + assert args[0] == request_msg + + def test_asset_service_rest_lro_client(): client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), diff --git a/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py b/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py index c943272ba2..94f791935d 100755 --- a/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py +++ b/tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py @@ -2925,16 +2925,17 @@ def test_initialize_client_w_grpc(): def test_generate_access_token_empty_call_grpc(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.generate_access_token), '__call__') as call: call.return_value = common.GenerateAccessTokenResponse() client.generate_access_token(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() @@ -2947,16 +2948,17 @@ def test_generate_access_token_empty_call_grpc(): def test_generate_id_token_empty_call_grpc(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.generate_id_token), '__call__') as call: call.return_value = common.GenerateIdTokenResponse() client.generate_id_token(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() @@ -2969,16 +2971,17 @@ def test_generate_id_token_empty_call_grpc(): def test_sign_blob_empty_call_grpc(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.sign_blob), '__call__') as call: call.return_value = common.SignBlobResponse() client.sign_blob(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() @@ -2991,16 +2994,17 @@ def test_sign_blob_empty_call_grpc(): def test_sign_jwt_empty_call_grpc(): client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.sign_jwt), '__call__') as call: call.return_value = common.SignJwtResponse() client.sign_jwt(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() @@ -3029,9 +3033,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_generate_access_token_empty_call_grpc_asyncio(): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.generate_access_token), '__call__') as call: @@ -3041,7 +3046,7 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): )) await client.generate_access_token(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateAccessTokenRequest() @@ -3055,9 +3060,10 @@ async def test_generate_access_token_empty_call_grpc_asyncio(): async def test_generate_id_token_empty_call_grpc_asyncio(): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.generate_id_token), '__call__') as call: @@ -3067,7 +3073,7 @@ async def test_generate_id_token_empty_call_grpc_asyncio(): )) await client.generate_id_token(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.GenerateIdTokenRequest() @@ -3081,9 +3087,10 @@ async def test_generate_id_token_empty_call_grpc_asyncio(): async def test_sign_blob_empty_call_grpc_asyncio(): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.sign_blob), '__call__') as call: @@ -3094,7 +3101,7 @@ async def test_sign_blob_empty_call_grpc_asyncio(): )) await client.sign_blob(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignBlobRequest() @@ -3108,9 +3115,10 @@ async def test_sign_blob_empty_call_grpc_asyncio(): async def test_sign_jwt_empty_call_grpc_asyncio(): client = IAMCredentialsAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.sign_jwt), '__call__') as call: @@ -3121,7 +3129,7 @@ async def test_sign_jwt_empty_call_grpc_asyncio(): )) await client.sign_jwt(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = common.SignJwtRequest() @@ -3543,6 +3551,94 @@ def test_initialize_client_w_rest(): assert client is not None +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_generate_access_token_empty_call_rest(): + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.generate_access_token), + '__call__') as call: + client.generate_access_token(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = common.GenerateAccessTokenRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_generate_id_token_empty_call_rest(): + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.generate_id_token), + '__call__') as call: + client.generate_id_token(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = common.GenerateIdTokenRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_sign_blob_empty_call_rest(): + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.sign_blob), + '__call__') as call: + client.sign_blob(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = common.SignBlobRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_sign_jwt_empty_call_rest(): + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.sign_jwt), + '__call__') as call: + client.sign_jwt(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = common.SignJwtRequest() + + assert args[0] == request_msg + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = IAMCredentialsClient( diff --git a/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py b/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py index d9b3d3d26b..fac54c7318 100755 --- a/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py +++ b/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py @@ -10852,16 +10852,17 @@ def test_initialize_client_w_grpc(): def test_get_trigger_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_trigger), '__call__') as call: call.return_value = trigger.Trigger() client.get_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() @@ -10874,16 +10875,17 @@ def test_get_trigger_empty_call_grpc(): def test_list_triggers_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_triggers), '__call__') as call: call.return_value = eventarc.ListTriggersResponse() client.list_triggers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() @@ -10896,16 +10898,17 @@ def test_list_triggers_empty_call_grpc(): def test_create_trigger_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_trigger), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() @@ -10918,16 +10921,17 @@ def test_create_trigger_empty_call_grpc(): def test_update_trigger_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_trigger), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.update_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() @@ -10940,16 +10944,17 @@ def test_update_trigger_empty_call_grpc(): def test_delete_trigger_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_trigger), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.delete_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() @@ -10962,16 +10967,17 @@ def test_delete_trigger_empty_call_grpc(): def test_get_channel_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_channel), '__call__') as call: call.return_value = channel.Channel() client.get_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() @@ -10984,16 +10990,17 @@ def test_get_channel_empty_call_grpc(): def test_list_channels_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_channels), '__call__') as call: call.return_value = eventarc.ListChannelsResponse() client.list_channels(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() @@ -11006,16 +11013,17 @@ def test_list_channels_empty_call_grpc(): def test_create_channel_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_channel_), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() @@ -11028,16 +11036,17 @@ def test_create_channel_empty_call_grpc(): def test_update_channel_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_channel), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.update_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() @@ -11050,16 +11059,17 @@ def test_update_channel_empty_call_grpc(): def test_delete_channel_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_channel), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.delete_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() @@ -11072,16 +11082,17 @@ def test_delete_channel_empty_call_grpc(): def test_get_provider_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_provider), '__call__') as call: call.return_value = discovery.Provider() client.get_provider(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() @@ -11094,16 +11105,17 @@ def test_get_provider_empty_call_grpc(): def test_list_providers_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_providers), '__call__') as call: call.return_value = eventarc.ListProvidersResponse() client.list_providers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() @@ -11116,16 +11128,17 @@ def test_list_providers_empty_call_grpc(): def test_get_channel_connection_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_channel_connection), '__call__') as call: call.return_value = channel_connection.ChannelConnection() client.get_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() @@ -11138,16 +11151,17 @@ def test_get_channel_connection_empty_call_grpc(): def test_list_channel_connections_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_channel_connections), '__call__') as call: call.return_value = eventarc.ListChannelConnectionsResponse() client.list_channel_connections(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() @@ -11160,16 +11174,17 @@ def test_list_channel_connections_empty_call_grpc(): def test_create_channel_connection_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_channel_connection), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() @@ -11182,16 +11197,17 @@ def test_create_channel_connection_empty_call_grpc(): def test_delete_channel_connection_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_channel_connection), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.delete_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() @@ -11204,16 +11220,17 @@ def test_delete_channel_connection_empty_call_grpc(): def test_get_google_channel_config_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_google_channel_config), '__call__') as call: call.return_value = google_channel_config.GoogleChannelConfig() client.get_google_channel_config(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() @@ -11226,16 +11243,17 @@ def test_get_google_channel_config_empty_call_grpc(): def test_update_google_channel_config_empty_call_grpc(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_google_channel_config), '__call__') as call: call.return_value = gce_google_channel_config.GoogleChannelConfig() client.update_google_channel_config(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() @@ -11264,9 +11282,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_get_trigger_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_trigger), '__call__') as call: @@ -11280,7 +11299,7 @@ async def test_get_trigger_empty_call_grpc_asyncio(): )) await client.get_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetTriggerRequest() @@ -11294,9 +11313,10 @@ async def test_get_trigger_empty_call_grpc_asyncio(): async def test_list_triggers_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_triggers), '__call__') as call: @@ -11307,7 +11327,7 @@ async def test_list_triggers_empty_call_grpc_asyncio(): )) await client.list_triggers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListTriggersRequest() @@ -11321,9 +11341,10 @@ async def test_list_triggers_empty_call_grpc_asyncio(): async def test_create_trigger_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_trigger), '__call__') as call: @@ -11333,7 +11354,7 @@ async def test_create_trigger_empty_call_grpc_asyncio(): ) await client.create_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateTriggerRequest() @@ -11347,9 +11368,10 @@ async def test_create_trigger_empty_call_grpc_asyncio(): async def test_update_trigger_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_trigger), '__call__') as call: @@ -11359,7 +11381,7 @@ async def test_update_trigger_empty_call_grpc_asyncio(): ) await client.update_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateTriggerRequest() @@ -11373,9 +11395,10 @@ async def test_update_trigger_empty_call_grpc_asyncio(): async def test_delete_trigger_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_trigger), '__call__') as call: @@ -11385,7 +11408,7 @@ async def test_delete_trigger_empty_call_grpc_asyncio(): ) await client.delete_trigger(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteTriggerRequest() @@ -11399,9 +11422,10 @@ async def test_delete_trigger_empty_call_grpc_asyncio(): async def test_get_channel_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_channel), '__call__') as call: @@ -11416,7 +11440,7 @@ async def test_get_channel_empty_call_grpc_asyncio(): )) await client.get_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelRequest() @@ -11430,9 +11454,10 @@ async def test_get_channel_empty_call_grpc_asyncio(): async def test_list_channels_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_channels), '__call__') as call: @@ -11443,7 +11468,7 @@ async def test_list_channels_empty_call_grpc_asyncio(): )) await client.list_channels(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelsRequest() @@ -11457,9 +11482,10 @@ async def test_list_channels_empty_call_grpc_asyncio(): async def test_create_channel_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_channel_), '__call__') as call: @@ -11469,7 +11495,7 @@ async def test_create_channel_empty_call_grpc_asyncio(): ) await client.create_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelRequest() @@ -11483,9 +11509,10 @@ async def test_create_channel_empty_call_grpc_asyncio(): async def test_update_channel_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_channel), '__call__') as call: @@ -11495,7 +11522,7 @@ async def test_update_channel_empty_call_grpc_asyncio(): ) await client.update_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateChannelRequest() @@ -11509,9 +11536,10 @@ async def test_update_channel_empty_call_grpc_asyncio(): async def test_delete_channel_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_channel), '__call__') as call: @@ -11521,7 +11549,7 @@ async def test_delete_channel_empty_call_grpc_asyncio(): ) await client.delete_channel(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelRequest() @@ -11535,9 +11563,10 @@ async def test_delete_channel_empty_call_grpc_asyncio(): async def test_get_provider_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_provider), '__call__') as call: @@ -11548,7 +11577,7 @@ async def test_get_provider_empty_call_grpc_asyncio(): )) await client.get_provider(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetProviderRequest() @@ -11562,9 +11591,10 @@ async def test_get_provider_empty_call_grpc_asyncio(): async def test_list_providers_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_providers), '__call__') as call: @@ -11575,7 +11605,7 @@ async def test_list_providers_empty_call_grpc_asyncio(): )) await client.list_providers(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListProvidersRequest() @@ -11589,9 +11619,10 @@ async def test_list_providers_empty_call_grpc_asyncio(): async def test_get_channel_connection_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_channel_connection), '__call__') as call: @@ -11604,7 +11635,7 @@ async def test_get_channel_connection_empty_call_grpc_asyncio(): )) await client.get_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetChannelConnectionRequest() @@ -11618,9 +11649,10 @@ async def test_get_channel_connection_empty_call_grpc_asyncio(): async def test_list_channel_connections_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_channel_connections), '__call__') as call: @@ -11631,7 +11663,7 @@ async def test_list_channel_connections_empty_call_grpc_asyncio(): )) await client.list_channel_connections(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.ListChannelConnectionsRequest() @@ -11645,9 +11677,10 @@ async def test_list_channel_connections_empty_call_grpc_asyncio(): async def test_create_channel_connection_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_channel_connection), '__call__') as call: @@ -11657,7 +11690,7 @@ async def test_create_channel_connection_empty_call_grpc_asyncio(): ) await client.create_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.CreateChannelConnectionRequest() @@ -11671,9 +11704,10 @@ async def test_create_channel_connection_empty_call_grpc_asyncio(): async def test_delete_channel_connection_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_channel_connection), '__call__') as call: @@ -11683,7 +11717,7 @@ async def test_delete_channel_connection_empty_call_grpc_asyncio(): ) await client.delete_channel_connection(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.DeleteChannelConnectionRequest() @@ -11697,9 +11731,10 @@ async def test_delete_channel_connection_empty_call_grpc_asyncio(): async def test_get_google_channel_config_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_google_channel_config), '__call__') as call: @@ -11710,7 +11745,7 @@ async def test_get_google_channel_config_empty_call_grpc_asyncio(): )) await client.get_google_channel_config(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.GetGoogleChannelConfigRequest() @@ -11724,9 +11759,10 @@ async def test_get_google_channel_config_empty_call_grpc_asyncio(): async def test_update_google_channel_config_empty_call_grpc_asyncio(): client = EventarcAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_google_channel_config), '__call__') as call: @@ -11737,7 +11773,7 @@ async def test_update_google_channel_config_empty_call_grpc_asyncio(): )) await client.update_google_channel_config(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = eventarc.UpdateGoogleChannelConfigRequest() @@ -14383,6 +14419,402 @@ def test_initialize_client_w_rest(): assert client is not None +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_trigger_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_trigger), + '__call__') as call: + client.get_trigger(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.GetTriggerRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_triggers_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_triggers), + '__call__') as call: + client.list_triggers(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.ListTriggersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_trigger_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_trigger), + '__call__') as call: + client.create_trigger(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.CreateTriggerRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_trigger_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_trigger), + '__call__') as call: + client.update_trigger(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.UpdateTriggerRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_trigger_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_trigger), + '__call__') as call: + client.delete_trigger(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.DeleteTriggerRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_channel_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_channel), + '__call__') as call: + client.get_channel(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.GetChannelRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_channels_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_channels), + '__call__') as call: + client.list_channels(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.ListChannelsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_channel_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_), + '__call__') as call: + client.create_channel(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.CreateChannelRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_channel_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_channel), + '__call__') as call: + client.update_channel(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.UpdateChannelRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_channel_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel), + '__call__') as call: + client.delete_channel(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.DeleteChannelRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_provider_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_provider), + '__call__') as call: + client.get_provider(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.GetProviderRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_providers_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_providers), + '__call__') as call: + client.list_providers(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.ListProvidersRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_channel_connection_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_connection), + '__call__') as call: + client.get_channel_connection(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.GetChannelConnectionRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_channel_connections_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_connections), + '__call__') as call: + client.list_channel_connections(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.ListChannelConnectionsRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_channel_connection_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_connection), + '__call__') as call: + client.create_channel_connection(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.CreateChannelConnectionRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_channel_connection_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_connection), + '__call__') as call: + client.delete_channel_connection(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.DeleteChannelConnectionRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_google_channel_config_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_google_channel_config), + '__call__') as call: + client.get_google_channel_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.GetGoogleChannelConfigRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_google_channel_config_empty_call_rest(): + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_google_channel_config), + '__call__') as call: + client.update_google_channel_config(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = eventarc.UpdateGoogleChannelConfigRequest() + + assert args[0] == request_msg + + def test_eventarc_rest_lro_client(): client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), diff --git a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py index 80b4f75e6e..9afec2b189 100755 --- a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py +++ b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py @@ -10925,16 +10925,17 @@ def test_initialize_client_w_grpc(): def test_list_buckets_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_buckets), '__call__') as call: call.return_value = logging_config.ListBucketsResponse() client.list_buckets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() @@ -10947,16 +10948,17 @@ def test_list_buckets_empty_call_grpc(): def test_get_bucket_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_bucket), '__call__') as call: call.return_value = logging_config.LogBucket() client.get_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() @@ -10969,16 +10971,17 @@ def test_get_bucket_empty_call_grpc(): def test_create_bucket_async_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_bucket_async), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_bucket_async(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() @@ -10991,16 +10994,17 @@ def test_create_bucket_async_empty_call_grpc(): def test_update_bucket_async_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_bucket_async), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.update_bucket_async(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() @@ -11013,16 +11017,17 @@ def test_update_bucket_async_empty_call_grpc(): def test_create_bucket_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_bucket), '__call__') as call: call.return_value = logging_config.LogBucket() client.create_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() @@ -11035,16 +11040,17 @@ def test_create_bucket_empty_call_grpc(): def test_update_bucket_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_bucket), '__call__') as call: call.return_value = logging_config.LogBucket() client.update_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() @@ -11057,16 +11063,17 @@ def test_update_bucket_empty_call_grpc(): def test_delete_bucket_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_bucket), '__call__') as call: call.return_value = None client.delete_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() @@ -11079,16 +11086,17 @@ def test_delete_bucket_empty_call_grpc(): def test_undelete_bucket_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.undelete_bucket), '__call__') as call: call.return_value = None client.undelete_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() @@ -11101,16 +11109,17 @@ def test_undelete_bucket_empty_call_grpc(): def test_list_views_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_views), '__call__') as call: call.return_value = logging_config.ListViewsResponse() client.list_views(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() @@ -11123,16 +11132,17 @@ def test_list_views_empty_call_grpc(): def test_get_view_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_view), '__call__') as call: call.return_value = logging_config.LogView() client.get_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() @@ -11145,16 +11155,17 @@ def test_get_view_empty_call_grpc(): def test_create_view_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_view), '__call__') as call: call.return_value = logging_config.LogView() client.create_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() @@ -11167,16 +11178,17 @@ def test_create_view_empty_call_grpc(): def test_update_view_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_view), '__call__') as call: call.return_value = logging_config.LogView() client.update_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() @@ -11189,16 +11201,17 @@ def test_update_view_empty_call_grpc(): def test_delete_view_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_view), '__call__') as call: call.return_value = None client.delete_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() @@ -11211,16 +11224,17 @@ def test_delete_view_empty_call_grpc(): def test_list_sinks_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_sinks), '__call__') as call: call.return_value = logging_config.ListSinksResponse() client.list_sinks(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() @@ -11233,16 +11247,17 @@ def test_list_sinks_empty_call_grpc(): def test_get_sink_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_sink), '__call__') as call: call.return_value = logging_config.LogSink() client.get_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() @@ -11255,16 +11270,17 @@ def test_get_sink_empty_call_grpc(): def test_create_sink_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_sink), '__call__') as call: call.return_value = logging_config.LogSink() client.create_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() @@ -11277,16 +11293,17 @@ def test_create_sink_empty_call_grpc(): def test_update_sink_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_sink), '__call__') as call: call.return_value = logging_config.LogSink() client.update_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() @@ -11299,16 +11316,17 @@ def test_update_sink_empty_call_grpc(): def test_delete_sink_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_sink), '__call__') as call: call.return_value = None client.delete_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() @@ -11321,16 +11339,17 @@ def test_delete_sink_empty_call_grpc(): def test_create_link_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_link), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() @@ -11343,16 +11362,17 @@ def test_create_link_empty_call_grpc(): def test_delete_link_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_link), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.delete_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() @@ -11365,16 +11385,17 @@ def test_delete_link_empty_call_grpc(): def test_list_links_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_links), '__call__') as call: call.return_value = logging_config.ListLinksResponse() client.list_links(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() @@ -11387,16 +11408,17 @@ def test_list_links_empty_call_grpc(): def test_get_link_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_link), '__call__') as call: call.return_value = logging_config.Link() client.get_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() @@ -11409,16 +11431,17 @@ def test_get_link_empty_call_grpc(): def test_list_exclusions_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_exclusions), '__call__') as call: call.return_value = logging_config.ListExclusionsResponse() client.list_exclusions(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() @@ -11431,16 +11454,17 @@ def test_list_exclusions_empty_call_grpc(): def test_get_exclusion_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_exclusion), '__call__') as call: call.return_value = logging_config.LogExclusion() client.get_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() @@ -11453,16 +11477,17 @@ def test_get_exclusion_empty_call_grpc(): def test_create_exclusion_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_exclusion), '__call__') as call: call.return_value = logging_config.LogExclusion() client.create_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() @@ -11475,16 +11500,17 @@ def test_create_exclusion_empty_call_grpc(): def test_update_exclusion_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_exclusion), '__call__') as call: call.return_value = logging_config.LogExclusion() client.update_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() @@ -11497,16 +11523,17 @@ def test_update_exclusion_empty_call_grpc(): def test_delete_exclusion_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_exclusion), '__call__') as call: call.return_value = None client.delete_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() @@ -11519,16 +11546,17 @@ def test_delete_exclusion_empty_call_grpc(): def test_get_cmek_settings_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_cmek_settings), '__call__') as call: call.return_value = logging_config.CmekSettings() client.get_cmek_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() @@ -11541,16 +11569,17 @@ def test_get_cmek_settings_empty_call_grpc(): def test_update_cmek_settings_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_cmek_settings), '__call__') as call: call.return_value = logging_config.CmekSettings() client.update_cmek_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() @@ -11563,16 +11592,17 @@ def test_update_cmek_settings_empty_call_grpc(): def test_get_settings_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_settings), '__call__') as call: call.return_value = logging_config.Settings() client.get_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() @@ -11585,16 +11615,17 @@ def test_get_settings_empty_call_grpc(): def test_update_settings_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_settings), '__call__') as call: call.return_value = logging_config.Settings() client.update_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() @@ -11607,16 +11638,17 @@ def test_update_settings_empty_call_grpc(): def test_copy_log_entries_empty_call_grpc(): client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.copy_log_entries), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.copy_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() @@ -11645,9 +11677,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_list_buckets_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_buckets), '__call__') as call: @@ -11657,7 +11690,7 @@ async def test_list_buckets_empty_call_grpc_asyncio(): )) await client.list_buckets(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListBucketsRequest() @@ -11671,9 +11704,10 @@ async def test_list_buckets_empty_call_grpc_asyncio(): async def test_get_bucket_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_bucket), '__call__') as call: @@ -11689,7 +11723,7 @@ async def test_get_bucket_empty_call_grpc_asyncio(): )) await client.get_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetBucketRequest() @@ -11703,9 +11737,10 @@ async def test_get_bucket_empty_call_grpc_asyncio(): async def test_create_bucket_async_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_bucket_async), '__call__') as call: @@ -11715,7 +11750,7 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): ) await client.create_bucket_async(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() @@ -11729,9 +11764,10 @@ async def test_create_bucket_async_empty_call_grpc_asyncio(): async def test_update_bucket_async_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_bucket_async), '__call__') as call: @@ -11741,7 +11777,7 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): ) await client.update_bucket_async(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() @@ -11755,9 +11791,10 @@ async def test_update_bucket_async_empty_call_grpc_asyncio(): async def test_create_bucket_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_bucket), '__call__') as call: @@ -11773,7 +11810,7 @@ async def test_create_bucket_empty_call_grpc_asyncio(): )) await client.create_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateBucketRequest() @@ -11787,9 +11824,10 @@ async def test_create_bucket_empty_call_grpc_asyncio(): async def test_update_bucket_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_bucket), '__call__') as call: @@ -11805,7 +11843,7 @@ async def test_update_bucket_empty_call_grpc_asyncio(): )) await client.update_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateBucketRequest() @@ -11819,9 +11857,10 @@ async def test_update_bucket_empty_call_grpc_asyncio(): async def test_delete_bucket_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_bucket), '__call__') as call: @@ -11829,7 +11868,7 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteBucketRequest() @@ -11843,9 +11882,10 @@ async def test_delete_bucket_empty_call_grpc_asyncio(): async def test_undelete_bucket_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.undelete_bucket), '__call__') as call: @@ -11853,7 +11893,7 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.undelete_bucket(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UndeleteBucketRequest() @@ -11867,9 +11907,10 @@ async def test_undelete_bucket_empty_call_grpc_asyncio(): async def test_list_views_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_views), '__call__') as call: @@ -11879,7 +11920,7 @@ async def test_list_views_empty_call_grpc_asyncio(): )) await client.list_views(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListViewsRequest() @@ -11893,9 +11934,10 @@ async def test_list_views_empty_call_grpc_asyncio(): async def test_get_view_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_view), '__call__') as call: @@ -11907,7 +11949,7 @@ async def test_get_view_empty_call_grpc_asyncio(): )) await client.get_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetViewRequest() @@ -11921,9 +11963,10 @@ async def test_get_view_empty_call_grpc_asyncio(): async def test_create_view_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_view), '__call__') as call: @@ -11935,7 +11978,7 @@ async def test_create_view_empty_call_grpc_asyncio(): )) await client.create_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateViewRequest() @@ -11949,9 +11992,10 @@ async def test_create_view_empty_call_grpc_asyncio(): async def test_update_view_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_view), '__call__') as call: @@ -11963,7 +12007,7 @@ async def test_update_view_empty_call_grpc_asyncio(): )) await client.update_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateViewRequest() @@ -11977,9 +12021,10 @@ async def test_update_view_empty_call_grpc_asyncio(): async def test_delete_view_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_view), '__call__') as call: @@ -11987,7 +12032,7 @@ async def test_delete_view_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_view(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteViewRequest() @@ -12001,9 +12046,10 @@ async def test_delete_view_empty_call_grpc_asyncio(): async def test_list_sinks_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_sinks), '__call__') as call: @@ -12013,7 +12059,7 @@ async def test_list_sinks_empty_call_grpc_asyncio(): )) await client.list_sinks(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListSinksRequest() @@ -12027,9 +12073,10 @@ async def test_list_sinks_empty_call_grpc_asyncio(): async def test_get_sink_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_sink), '__call__') as call: @@ -12046,7 +12093,7 @@ async def test_get_sink_empty_call_grpc_asyncio(): )) await client.get_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSinkRequest() @@ -12060,9 +12107,10 @@ async def test_get_sink_empty_call_grpc_asyncio(): async def test_create_sink_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_sink), '__call__') as call: @@ -12079,7 +12127,7 @@ async def test_create_sink_empty_call_grpc_asyncio(): )) await client.create_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateSinkRequest() @@ -12093,9 +12141,10 @@ async def test_create_sink_empty_call_grpc_asyncio(): async def test_update_sink_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_sink), '__call__') as call: @@ -12112,7 +12161,7 @@ async def test_update_sink_empty_call_grpc_asyncio(): )) await client.update_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSinkRequest() @@ -12126,9 +12175,10 @@ async def test_update_sink_empty_call_grpc_asyncio(): async def test_delete_sink_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_sink), '__call__') as call: @@ -12136,7 +12186,7 @@ async def test_delete_sink_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_sink(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteSinkRequest() @@ -12150,9 +12200,10 @@ async def test_delete_sink_empty_call_grpc_asyncio(): async def test_create_link_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_link), '__call__') as call: @@ -12162,7 +12213,7 @@ async def test_create_link_empty_call_grpc_asyncio(): ) await client.create_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateLinkRequest() @@ -12176,9 +12227,10 @@ async def test_create_link_empty_call_grpc_asyncio(): async def test_delete_link_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_link), '__call__') as call: @@ -12188,7 +12240,7 @@ async def test_delete_link_empty_call_grpc_asyncio(): ) await client.delete_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteLinkRequest() @@ -12202,9 +12254,10 @@ async def test_delete_link_empty_call_grpc_asyncio(): async def test_list_links_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_links), '__call__') as call: @@ -12214,7 +12267,7 @@ async def test_list_links_empty_call_grpc_asyncio(): )) await client.list_links(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListLinksRequest() @@ -12228,9 +12281,10 @@ async def test_list_links_empty_call_grpc_asyncio(): async def test_get_link_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_link), '__call__') as call: @@ -12242,7 +12296,7 @@ async def test_get_link_empty_call_grpc_asyncio(): )) await client.get_link(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetLinkRequest() @@ -12256,9 +12310,10 @@ async def test_get_link_empty_call_grpc_asyncio(): async def test_list_exclusions_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_exclusions), '__call__') as call: @@ -12268,7 +12323,7 @@ async def test_list_exclusions_empty_call_grpc_asyncio(): )) await client.list_exclusions(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.ListExclusionsRequest() @@ -12282,9 +12337,10 @@ async def test_list_exclusions_empty_call_grpc_asyncio(): async def test_get_exclusion_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_exclusion), '__call__') as call: @@ -12297,7 +12353,7 @@ async def test_get_exclusion_empty_call_grpc_asyncio(): )) await client.get_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetExclusionRequest() @@ -12311,9 +12367,10 @@ async def test_get_exclusion_empty_call_grpc_asyncio(): async def test_create_exclusion_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_exclusion), '__call__') as call: @@ -12326,7 +12383,7 @@ async def test_create_exclusion_empty_call_grpc_asyncio(): )) await client.create_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CreateExclusionRequest() @@ -12340,9 +12397,10 @@ async def test_create_exclusion_empty_call_grpc_asyncio(): async def test_update_exclusion_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_exclusion), '__call__') as call: @@ -12355,7 +12413,7 @@ async def test_update_exclusion_empty_call_grpc_asyncio(): )) await client.update_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateExclusionRequest() @@ -12369,9 +12427,10 @@ async def test_update_exclusion_empty_call_grpc_asyncio(): async def test_delete_exclusion_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_exclusion), '__call__') as call: @@ -12379,7 +12438,7 @@ async def test_delete_exclusion_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_exclusion(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.DeleteExclusionRequest() @@ -12393,9 +12452,10 @@ async def test_delete_exclusion_empty_call_grpc_asyncio(): async def test_get_cmek_settings_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_cmek_settings), '__call__') as call: @@ -12408,7 +12468,7 @@ async def test_get_cmek_settings_empty_call_grpc_asyncio(): )) await client.get_cmek_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetCmekSettingsRequest() @@ -12422,9 +12482,10 @@ async def test_get_cmek_settings_empty_call_grpc_asyncio(): async def test_update_cmek_settings_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_cmek_settings), '__call__') as call: @@ -12437,7 +12498,7 @@ async def test_update_cmek_settings_empty_call_grpc_asyncio(): )) await client.update_cmek_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateCmekSettingsRequest() @@ -12451,9 +12512,10 @@ async def test_update_cmek_settings_empty_call_grpc_asyncio(): async def test_get_settings_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_settings), '__call__') as call: @@ -12467,7 +12529,7 @@ async def test_get_settings_empty_call_grpc_asyncio(): )) await client.get_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.GetSettingsRequest() @@ -12481,9 +12543,10 @@ async def test_get_settings_empty_call_grpc_asyncio(): async def test_update_settings_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_settings), '__call__') as call: @@ -12497,7 +12560,7 @@ async def test_update_settings_empty_call_grpc_asyncio(): )) await client.update_settings(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.UpdateSettingsRequest() @@ -12511,9 +12574,10 @@ async def test_update_settings_empty_call_grpc_asyncio(): async def test_copy_log_entries_empty_call_grpc_asyncio(): client = ConfigServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.copy_log_entries), '__call__') as call: @@ -12523,7 +12587,7 @@ async def test_copy_log_entries_empty_call_grpc_asyncio(): ) await client.copy_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_config.CopyLogEntriesRequest() diff --git a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py index bb21903760..e68ade7f1e 100755 --- a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py +++ b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py @@ -2913,16 +2913,17 @@ def test_initialize_client_w_grpc(): def test_delete_log_empty_call_grpc(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_log), '__call__') as call: call.return_value = None client.delete_log(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() @@ -2935,16 +2936,17 @@ def test_delete_log_empty_call_grpc(): def test_write_log_entries_empty_call_grpc(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.write_log_entries), '__call__') as call: call.return_value = logging.WriteLogEntriesResponse() client.write_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() @@ -2957,16 +2959,17 @@ def test_write_log_entries_empty_call_grpc(): def test_list_log_entries_empty_call_grpc(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_log_entries), '__call__') as call: call.return_value = logging.ListLogEntriesResponse() client.list_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() @@ -2979,16 +2982,17 @@ def test_list_log_entries_empty_call_grpc(): def test_list_monitored_resource_descriptors_empty_call_grpc(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_monitored_resource_descriptors), '__call__') as call: call.return_value = logging.ListMonitoredResourceDescriptorsResponse() client.list_monitored_resource_descriptors(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() @@ -3001,16 +3005,17 @@ def test_list_monitored_resource_descriptors_empty_call_grpc(): def test_list_logs_empty_call_grpc(): client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_logs), '__call__') as call: call.return_value = logging.ListLogsResponse() client.list_logs(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() @@ -3039,9 +3044,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_delete_log_empty_call_grpc_asyncio(): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_log), '__call__') as call: @@ -3049,7 +3055,7 @@ async def test_delete_log_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_log(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.DeleteLogRequest() @@ -3063,9 +3069,10 @@ async def test_delete_log_empty_call_grpc_asyncio(): async def test_write_log_entries_empty_call_grpc_asyncio(): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.write_log_entries), '__call__') as call: @@ -3074,7 +3081,7 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): )) await client.write_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.WriteLogEntriesRequest() @@ -3088,9 +3095,10 @@ async def test_write_log_entries_empty_call_grpc_asyncio(): async def test_list_log_entries_empty_call_grpc_asyncio(): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_log_entries), '__call__') as call: @@ -3100,7 +3108,7 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): )) await client.list_log_entries(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogEntriesRequest() @@ -3114,9 +3122,10 @@ async def test_list_log_entries_empty_call_grpc_asyncio(): async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_monitored_resource_descriptors), '__call__') as call: @@ -3126,7 +3135,7 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): )) await client.list_monitored_resource_descriptors(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListMonitoredResourceDescriptorsRequest() @@ -3140,9 +3149,10 @@ async def test_list_monitored_resource_descriptors_empty_call_grpc_asyncio(): async def test_list_logs_empty_call_grpc_asyncio(): client = LoggingServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_logs), '__call__') as call: @@ -3153,7 +3163,7 @@ async def test_list_logs_empty_call_grpc_asyncio(): )) await client.list_logs(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging.ListLogsRequest() diff --git a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py index a80079b399..6bcf51b2f5 100755 --- a/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py +++ b/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py @@ -2700,16 +2700,17 @@ def test_initialize_client_w_grpc(): def test_list_log_metrics_empty_call_grpc(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_log_metrics), '__call__') as call: call.return_value = logging_metrics.ListLogMetricsResponse() client.list_log_metrics(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() @@ -2722,16 +2723,17 @@ def test_list_log_metrics_empty_call_grpc(): def test_get_log_metric_empty_call_grpc(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_log_metric), '__call__') as call: call.return_value = logging_metrics.LogMetric() client.get_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() @@ -2744,16 +2746,17 @@ def test_get_log_metric_empty_call_grpc(): def test_create_log_metric_empty_call_grpc(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_log_metric), '__call__') as call: call.return_value = logging_metrics.LogMetric() client.create_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() @@ -2766,16 +2769,17 @@ def test_create_log_metric_empty_call_grpc(): def test_update_log_metric_empty_call_grpc(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_log_metric), '__call__') as call: call.return_value = logging_metrics.LogMetric() client.update_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() @@ -2788,16 +2792,17 @@ def test_update_log_metric_empty_call_grpc(): def test_delete_log_metric_empty_call_grpc(): client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_log_metric), '__call__') as call: call.return_value = None client.delete_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() @@ -2826,9 +2831,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_list_log_metrics_empty_call_grpc_asyncio(): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_log_metrics), '__call__') as call: @@ -2838,7 +2844,7 @@ async def test_list_log_metrics_empty_call_grpc_asyncio(): )) await client.list_log_metrics(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.ListLogMetricsRequest() @@ -2852,9 +2858,10 @@ async def test_list_log_metrics_empty_call_grpc_asyncio(): async def test_get_log_metric_empty_call_grpc_asyncio(): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_log_metric), '__call__') as call: @@ -2870,7 +2877,7 @@ async def test_get_log_metric_empty_call_grpc_asyncio(): )) await client.get_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.GetLogMetricRequest() @@ -2884,9 +2891,10 @@ async def test_get_log_metric_empty_call_grpc_asyncio(): async def test_create_log_metric_empty_call_grpc_asyncio(): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_log_metric), '__call__') as call: @@ -2902,7 +2910,7 @@ async def test_create_log_metric_empty_call_grpc_asyncio(): )) await client.create_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.CreateLogMetricRequest() @@ -2916,9 +2924,10 @@ async def test_create_log_metric_empty_call_grpc_asyncio(): async def test_update_log_metric_empty_call_grpc_asyncio(): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_log_metric), '__call__') as call: @@ -2934,7 +2943,7 @@ async def test_update_log_metric_empty_call_grpc_asyncio(): )) await client.update_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.UpdateLogMetricRequest() @@ -2948,9 +2957,10 @@ async def test_update_log_metric_empty_call_grpc_asyncio(): async def test_delete_log_metric_empty_call_grpc_asyncio(): client = MetricsServiceV2AsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_log_metric), '__call__') as call: @@ -2958,7 +2968,7 @@ async def test_delete_log_metric_empty_call_grpc_asyncio(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_log_metric(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = logging_metrics.DeleteLogMetricRequest() diff --git a/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py b/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py index 9e500de2c0..42b1aaca0c 100755 --- a/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py +++ b/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py @@ -6659,16 +6659,17 @@ def test_initialize_client_w_grpc(): def test_list_instances_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_instances), '__call__') as call: call.return_value = cloud_redis.ListInstancesResponse() client.list_instances(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() @@ -6681,16 +6682,17 @@ def test_list_instances_empty_call_grpc(): def test_get_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_instance), '__call__') as call: call.return_value = cloud_redis.Instance() client.get_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() @@ -6703,16 +6705,17 @@ def test_get_instance_empty_call_grpc(): def test_get_instance_auth_string_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_instance_auth_string), '__call__') as call: call.return_value = cloud_redis.InstanceAuthString() client.get_instance_auth_string(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() @@ -6725,16 +6728,17 @@ def test_get_instance_auth_string_empty_call_grpc(): def test_create_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.create_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() @@ -6747,16 +6751,17 @@ def test_create_instance_empty_call_grpc(): def test_update_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.update_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() @@ -6769,16 +6774,17 @@ def test_update_instance_empty_call_grpc(): def test_upgrade_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.upgrade_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.upgrade_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() @@ -6791,16 +6797,17 @@ def test_upgrade_instance_empty_call_grpc(): def test_import_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.import_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.import_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() @@ -6813,16 +6820,17 @@ def test_import_instance_empty_call_grpc(): def test_export_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.export_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.export_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() @@ -6835,16 +6843,17 @@ def test_export_instance_empty_call_grpc(): def test_failover_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.failover_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.failover_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() @@ -6857,16 +6866,17 @@ def test_failover_instance_empty_call_grpc(): def test_delete_instance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_instance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.delete_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() @@ -6879,16 +6889,17 @@ def test_delete_instance_empty_call_grpc(): def test_reschedule_maintenance_empty_call_grpc(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.reschedule_maintenance), '__call__') as call: call.return_value = operations_pb2.Operation(name='operations/op') client.reschedule_maintenance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() @@ -6917,9 +6928,10 @@ def test_initialize_client_w_grpc_asyncio(): async def test_list_instances_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.list_instances), '__call__') as call: @@ -6930,7 +6942,7 @@ async def test_list_instances_empty_call_grpc_asyncio(): )) await client.list_instances(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ListInstancesRequest() @@ -6944,9 +6956,10 @@ async def test_list_instances_empty_call_grpc_asyncio(): async def test_get_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_instance), '__call__') as call: @@ -6982,7 +6995,7 @@ async def test_get_instance_empty_call_grpc_asyncio(): )) await client.get_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceRequest() @@ -6996,9 +7009,10 @@ async def test_get_instance_empty_call_grpc_asyncio(): async def test_get_instance_auth_string_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.get_instance_auth_string), '__call__') as call: @@ -7008,7 +7022,7 @@ async def test_get_instance_auth_string_empty_call_grpc_asyncio(): )) await client.get_instance_auth_string(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.GetInstanceAuthStringRequest() @@ -7022,9 +7036,10 @@ async def test_get_instance_auth_string_empty_call_grpc_asyncio(): async def test_create_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.create_instance), '__call__') as call: @@ -7034,7 +7049,7 @@ async def test_create_instance_empty_call_grpc_asyncio(): ) await client.create_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.CreateInstanceRequest() @@ -7048,9 +7063,10 @@ async def test_create_instance_empty_call_grpc_asyncio(): async def test_update_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.update_instance), '__call__') as call: @@ -7060,7 +7076,7 @@ async def test_update_instance_empty_call_grpc_asyncio(): ) await client.update_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpdateInstanceRequest() @@ -7074,9 +7090,10 @@ async def test_update_instance_empty_call_grpc_asyncio(): async def test_upgrade_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.upgrade_instance), '__call__') as call: @@ -7086,7 +7103,7 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): ) await client.upgrade_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.UpgradeInstanceRequest() @@ -7100,9 +7117,10 @@ async def test_upgrade_instance_empty_call_grpc_asyncio(): async def test_import_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.import_instance), '__call__') as call: @@ -7112,7 +7130,7 @@ async def test_import_instance_empty_call_grpc_asyncio(): ) await client.import_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ImportInstanceRequest() @@ -7126,9 +7144,10 @@ async def test_import_instance_empty_call_grpc_asyncio(): async def test_export_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.export_instance), '__call__') as call: @@ -7138,7 +7157,7 @@ async def test_export_instance_empty_call_grpc_asyncio(): ) await client.export_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.ExportInstanceRequest() @@ -7152,9 +7171,10 @@ async def test_export_instance_empty_call_grpc_asyncio(): async def test_failover_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.failover_instance), '__call__') as call: @@ -7164,7 +7184,7 @@ async def test_failover_instance_empty_call_grpc_asyncio(): ) await client.failover_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.FailoverInstanceRequest() @@ -7178,9 +7198,10 @@ async def test_failover_instance_empty_call_grpc_asyncio(): async def test_delete_instance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.delete_instance), '__call__') as call: @@ -7190,7 +7211,7 @@ async def test_delete_instance_empty_call_grpc_asyncio(): ) await client.delete_instance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.DeleteInstanceRequest() @@ -7204,9 +7225,10 @@ async def test_delete_instance_empty_call_grpc_asyncio(): async def test_reschedule_maintenance_empty_call_grpc_asyncio(): client = CloudRedisAsyncClient( credentials=async_anonymous_credentials(), + transport="grpc_asyncio", ) - # Mock the actual call within the gRPC stub, and fake the request. + # Mock the actual call, and fake the request. with mock.patch.object( type(client.transport.reschedule_maintenance), '__call__') as call: @@ -7216,7 +7238,7 @@ async def test_reschedule_maintenance_empty_call_grpc_asyncio(): ) await client.reschedule_maintenance(request=None) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying stub method was called. call.assert_called() _, args, _ = call.mock_calls[0] request_msg = cloud_redis.RescheduleMaintenanceRequest() @@ -8775,6 +8797,248 @@ def test_initialize_client_w_rest(): assert client is not None +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_list_instances_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_instances), + '__call__') as call: + client.list_instances(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ListInstancesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_instance), + '__call__') as call: + client.get_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.GetInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_get_instance_auth_string_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_instance_auth_string), + '__call__') as call: + client.get_instance_auth_string(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.GetInstanceAuthStringRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_create_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_instance), + '__call__') as call: + client.create_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.CreateInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_update_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_instance), + '__call__') as call: + client.update_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.UpdateInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_upgrade_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.upgrade_instance), + '__call__') as call: + client.upgrade_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.UpgradeInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_import_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.import_instance), + '__call__') as call: + client.import_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ImportInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_export_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.export_instance), + '__call__') as call: + client.export_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ExportInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_failover_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.failover_instance), + '__call__') as call: + client.failover_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.FailoverInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_delete_instance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_instance), + '__call__') as call: + client.delete_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.DeleteInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +def test_reschedule_maintenance_empty_call_rest(): + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.reschedule_maintenance), + '__call__') as call: + client.reschedule_maintenance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.RescheduleMaintenanceRequest() + + assert args[0] == request_msg + + def test_cloud_redis_rest_lro_client(): client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10442,6 +10706,281 @@ def test_initialize_client_w_rest_asyncio(): assert client is not None +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_list_instances_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.list_instances), + '__call__') as call: + await client.list_instances(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ListInstancesRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_instance), + '__call__') as call: + await client.get_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.GetInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_get_instance_auth_string_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.get_instance_auth_string), + '__call__') as call: + await client.get_instance_auth_string(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.GetInstanceAuthStringRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_create_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.create_instance), + '__call__') as call: + await client.create_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.CreateInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_update_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.update_instance), + '__call__') as call: + await client.update_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.UpdateInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_upgrade_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.upgrade_instance), + '__call__') as call: + await client.upgrade_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.UpgradeInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_import_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.import_instance), + '__call__') as call: + await client.import_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ImportInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_export_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.export_instance), + '__call__') as call: + await client.export_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.ExportInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_failover_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.failover_instance), + '__call__') as call: + await client.failover_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.FailoverInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_delete_instance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.delete_instance), + '__call__') as call: + await client.delete_instance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.DeleteInstanceRequest() + + assert args[0] == request_msg + + +# This test is a coverage failsafe to make sure that totally empty calls, +# i.e. request == None and no flattened fields passed, work. +@pytest.mark.asyncio +async def test_reschedule_maintenance_empty_call_rest_asyncio(): + if not HAS_ASYNC_REST_EXTRA: + pytest.skip("the library must be installed with the `async_rest` extra to test this feature.") + client = CloudRedisAsyncClient( + credentials=async_anonymous_credentials(), + transport="rest_asyncio", + ) + + # Mock the actual call, and fake the request. + with mock.patch.object( + type(client.transport.reschedule_maintenance), + '__call__') as call: + await client.reschedule_maintenance(request=None) + + # Establish that the underlying stub method was called. + call.assert_called() + _, args, _ = call.mock_calls[0] + request_msg = cloud_redis.RescheduleMaintenanceRequest() + + assert args[0] == request_msg + + def test_cloud_redis_rest_asyncio_lro_client(): if not HAS_ASYNC_REST_EXTRA: pytest.skip("the library must be installed with the `async_rest` extra to test this feature.")