From 68a79a57f2831a6aedfb622bb11672d0d7b7708c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 20 Mar 2024 19:18:59 +0000 Subject: [PATCH 01/14] feat: Automatically populate uuid4 fields --- .../%sub/services/%service/client.py.j2 | 24 + .../%name_%version/%sub/test_%service.py.j2 | 35 +- .../%sub/services/%service/_client_macros.j2 | 25 + .../%sub/services/%service/async_client.py.j2 | 6 + .../%sub/services/%service/client.py.j2 | 3 + .../%name_%version/%sub/test_%service.py.j2 | 7 +- .../gapic/%name_%version/%sub/test_macros.j2 | 110 +- .../unit/gapic/asset_v1/test_asset_service.py | 666 +++++++++++- .../credentials_v1/test_iam_credentials.py | 114 +- .../unit/gapic/eventarc_v1/test_eventarc.py | 523 +++++++++- .../logging_v2/test_config_service_v2.py | 972 ++++++++++++++++-- .../logging_v2/test_logging_service_v2.py | 138 ++- .../logging_v2/test_metrics_service_v2.py | 156 ++- .../unit/gapic/redis_v1/test_cloud_redis.py | 335 +++++- tests/system/test_unary.py | 34 + 15 files changed, 2934 insertions(+), 214 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 index 02e97a85fe..e68268bb38 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 @@ -6,6 +6,9 @@ from collections import OrderedDict import os import re from typing import Callable, Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +import uuid +{% endif %} {% if service.any_deprecated %} import warnings {% endif %} @@ -473,6 +476,27 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): ) {% endif %} +{# + Automatically populate UUID4 fields according to AIP-4235 + (https://google.aip.dev/client-libraries/4235) if the + field satisfies either of: + - The field supports explicit presence and has not been set by the user. + - The field doesn't support explicit presence, and its value is the empty + string (i.e. the default value). +#} +{% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} +{% if method_settings is not none %} +{% for auto_populated_field in method_settings.auto_populated_fields %} + {% if method.input.fields[auto_populated_field].proto3_optional %} + if '{{ auto_populated_field }}' not in request: + {% else %} + if not request.{{ auto_populated_field }}: + {% endif %} + request.{{ auto_populated_field }} = str(uuid.uuid4()) +{% endfor %} +{% endif %}{# if method_settings is not none #} +{% endwith %}{# method_settings #} + # Send the request. {%+ if not method.void %}response = {% endif %}rpc( {% if not method.client_streaming %} diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 6e5469c087..980afbfebc 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -3,6 +3,9 @@ {% block content %} import os +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +import re +{% endif %} # try/except added for compatibility with python < 3.8 try: from unittest import mock @@ -521,6 +524,18 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() + + {# Set UUID4 fields so that they are not automatically popoulated. #} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + if isinstance(request, dict): + request['{{ auto_populated_field }}'] = "str_value" + else: + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} {% if method.client_streaming %} requests = [request] {% endif %} @@ -568,7 +583,15 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% if method.client_streaming %} assert next(args[0]) == request {% else %} - assert args[0] == {{ method.input.ident }}() + request = {{ method.input.ident }}() + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} + assert args[0] == request {% endif %} # Establish that the response is the type that we expect. @@ -629,6 +652,16 @@ def test_{{ method_name }}_empty_call(): {% if method.client_streaming %} assert next(args[0]) == request {% else %} +{% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} +{% if method_settings is not none %} +{% for auto_populated_field in method_settings.auto_populated_fields %} + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None +{% endfor %} +{% endif %}{# if method_settings is not none #} +{% endwith %}{# method_settings #} assert args[0] == {{ method.input.ident }}() {% endif %} {% endif %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 index 9b0d07629e..7b64f02162 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 @@ -183,6 +183,8 @@ ) {% endif %} {# method.explicit_routing #} +{{ auto_populate_uuid4_fields(api, method) }} + # Validate the universe domain. self._validate_universe_domain() @@ -265,3 +267,26 @@ {% macro define_extended_operation_subclass(extended_operation) %} {% endmacro %} + +{% macro auto_populate_uuid4_fields(api, method) %} +{# + Automatically populate UUID4 fields according to AIP-4235 + (https://google.aip.dev/client-libraries/4235) if the + field satisfies either of: + - The field supports explicit presence and has not been set by the user. + - The field doesn't support explicit presence, and its value is the empty + string (i.e. the default value). +#} +{% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} +{% if method_settings is not none %} +{% for auto_populated_field in method_settings.auto_populated_fields %} + {% if method.input.fields[auto_populated_field].proto3_optional %} + if '{{ auto_populated_field }}' not in request: + {% else %} + if not request.{{ auto_populated_field }}: + {% endif %} + request.{{ auto_populated_field }} = str(uuid.uuid4()) +{% endfor %} +{% endif %}{# if method_settings is not none #} +{% endwith %}{# method_settings #} +{% endmacro %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 79ca0a1b78..d0c1daee9b 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -1,11 +1,15 @@ {% extends "_base.py.j2" %} {% block content %} +{% import "%namespace/%name_%version/%sub/services/%service/_client_macros.j2" as macros %} from collections import OrderedDict import functools import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +import uuid +{% endif %} {% if service.any_deprecated %} import warnings {% endif %} @@ -386,6 +390,8 @@ class {{ service.async_client_name }}: ) {% endif %} +{{ macros.auto_populate_uuid4_fields(api, method) }} + # Validate the universe domain. self._client._validate_universe_domain() diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index 80bd73bdac..62fcc94e29 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -10,6 +10,9 @@ import functools import os import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +import uuid +{% endif %} import warnings {% set package_path = api.naming.module_namespace|join('.') + "." + api.naming.versioned_module_name %} diff --git a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 3830c93d7b..6f150c25ae 100644 --- a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -4,6 +4,9 @@ {% import "tests/unit/gapic/%name_%version/%sub/test_macros.j2" as test_macros %} import os +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +import re +{% endif %} # try/except added for compatibility with python < 3.8 try: from unittest import mock @@ -849,10 +852,10 @@ def test_{{ service.client_name|snake_case }}_create_channel_credentials_file(cl {% for method in service.methods.values() if 'grpc' in opts.transport %}{# method_name #} {% if method.extended_lro %} -{{ test_macros.grpc_required_tests(method, service, full_extended_lro=True) }} +{{ test_macros.grpc_required_tests(method, service, api, full_extended_lro=True) }} {% endif %} -{{ test_macros.grpc_required_tests(method, service) }} +{{ test_macros.grpc_required_tests(method, service, api) }} {% endfor %} {# method in methods for grpc #} {% for method in service.methods.values() if 'rest' in opts.transport %} 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 40238952b9..70749c88e2 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 @@ -1,4 +1,4 @@ -{% macro grpc_required_tests(method, service, full_extended_lro=False) %} +{% macro grpc_required_tests(method, service, api, full_extended_lro=False) %} {% with method_name = method.safe_name|snake_case + "_unary" if method.extended_lro and not full_extended_lro else method.safe_name|snake_case, method_output = method.extended_lro.operation_type if method.extended_lro and not full_extended_lro else method.output %} @pytest.mark.parametrize("request_type", [ {{ method.input.ident }}, @@ -13,6 +13,17 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() + {# Set UUID4 fields so that they are not automatically popoulated. #} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + if isinstance(request, dict): + request['{{ auto_populated_field }}'] = "str_value" + else: + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} {% if method.client_streaming %} requests = [request] {% endif %} @@ -58,7 +69,15 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% if method.client_streaming %} assert next(args[0]) == request {% else %} - assert args[0] == {{ method.input.ident }}() + request = {{ method.input.ident }}() + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} + assert args[0] == request {% endif %} # Establish that the response is the type that we expect. @@ -119,11 +138,77 @@ def test_{{ method_name }}_empty_call(): {% if method.client_streaming %} assert next(args[0]) == request {% else %} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} assert args[0] == {{ method.input.ident }}() {% endif %} {% endif %} {% if not full_extended_lro %} +{% if not method.client_streaming %} +@pytest.mark.asyncio +async def test_{{ method_name }}_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = {{ service.async_client_name }}( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.{{ method.transport_safe_name|snake_case }}), + '__call__') as call: + # Designate an appropriate return value for the call. + {% if method.void %} + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + {% elif method.lro %} + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + {% elif not method.client_streaming and method.server_streaming %} + call.return_value = mock.Mock(aio.UnaryStreamCall, autospec=True) + call.return_value.read = mock.AsyncMock(side_effect=[{{ method.output.ident }}()]) + {% elif method.client_streaming and method.server_streaming %} + call.return_value = mock.Mock(aio.StreamStreamCall, autospec=True) + call.return_value.read = mock.AsyncMock(side_effect=[{{ method.output.ident }}()]) + {% else %} + call.return_value ={{ '' }} + {%- if not method.client_streaming and not method.server_streaming -%} + grpc_helpers_async.FakeUnaryUnaryCall + {%- else -%} + grpc_helpers_async.FakeStreamUnaryCall + {%- endif -%}({{ method.output.ident }}( + {% for field in method.output.fields.values() | rejectattr('message') %}{% if not field.oneof or field.proto3_optional %} + {{ field.name }}={{ field.mock_value }}, + {% endif %} + {% endfor %} + )) + {% endif %} + response = await client.{{ method_name }}() + call.assert_called() + _, args, _ = call.mock_calls[0] + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} + assert args[0] == {{ method.input.ident }}() +{% endif %} + @pytest.mark.asyncio async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_type={{ method.input.ident }}): client = {{ service.async_client_name }}( @@ -134,6 +219,17 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() + {# Set UUID4 fields so that they are not automatically popoulated. #} + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + if isinstance(request, dict): + request['{{ auto_populated_field }}'] = "str_value" + else: + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} {% if method.client_streaming %} requests = [request] {% endif %} @@ -182,7 +278,15 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ {% if method.client_streaming %} assert next(args[0]) == request {% else %} - assert args[0] == {{ method.input.ident }}() + request = {{ method.input.ident }}() + {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} + {% if method_settings is not none %} + {% for auto_populated_field in method_settings.auto_populated_fields %} + request.{{ auto_populated_field }} = "str_value" + {% endfor %} + {% endif %}{# if method_settings is not none #} + {% endwith %}{# method_settings #} + assert args[0] == request {% endif %} # Establish that the response is the type that we expect. 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 69d0c6c12f..c1b4b5645d 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 @@ -793,7 +793,8 @@ def test_export_assets(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ExportAssetsRequest() + request = asset_service.ExportAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -816,6 +817,28 @@ def test_export_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ExportAssetsRequest() +@pytest.mark.asyncio +async def test_export_assets_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.export_assets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.export_assets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ExportAssetsRequest() + @pytest.mark.asyncio async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ExportAssetsRequest): client = AssetServiceAsyncClient( @@ -840,7 +863,8 @@ async def test_export_assets_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ExportAssetsRequest() + request = asset_service.ExportAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -941,7 +965,8 @@ def test_list_assets(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListAssetsRequest() + request = asset_service.ListAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListAssetsPager) @@ -965,6 +990,28 @@ def test_list_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListAssetsRequest() +@pytest.mark.asyncio +async def test_list_assets_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_assets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListAssetsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_assets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListAssetsRequest() + @pytest.mark.asyncio async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListAssetsRequest): client = AssetServiceAsyncClient( @@ -989,7 +1036,8 @@ async def test_list_assets_async(transport: str = 'grpc_asyncio', request_type=a # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListAssetsRequest() + request = asset_service.ListAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListAssetsAsyncPager) @@ -1364,7 +1412,8 @@ def test_batch_get_assets_history(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetAssetsHistoryRequest() + request = asset_service.BatchGetAssetsHistoryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetAssetsHistoryResponse) @@ -1387,6 +1436,27 @@ def test_batch_get_assets_history_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.BatchGetAssetsHistoryRequest() +@pytest.mark.asyncio +async def test_batch_get_assets_history_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_get_assets_history), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetAssetsHistoryResponse( + )) + response = await client.batch_get_assets_history() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.BatchGetAssetsHistoryRequest() + @pytest.mark.asyncio async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetAssetsHistoryRequest): client = AssetServiceAsyncClient( @@ -1410,7 +1480,8 @@ async def test_batch_get_assets_history_async(transport: str = 'grpc_asyncio', r # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetAssetsHistoryRequest() + request = asset_service.BatchGetAssetsHistoryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetAssetsHistoryResponse) @@ -1515,7 +1586,8 @@ def test_create_feed(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateFeedRequest() + request = asset_service.CreateFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -1543,6 +1615,32 @@ def test_create_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.CreateFeedRequest() +@pytest.mark.asyncio +async def test_create_feed_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_feed), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + name='name_value', + asset_names=['asset_names_value'], + asset_types=['asset_types_value'], + content_type=asset_service.ContentType.RESOURCE, + relationship_types=['relationship_types_value'], + )) + response = await client.create_feed() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.CreateFeedRequest() + @pytest.mark.asyncio async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateFeedRequest): client = AssetServiceAsyncClient( @@ -1571,7 +1669,8 @@ async def test_create_feed_async(transport: str = 'grpc_asyncio', request_type=a # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateFeedRequest() + request = asset_service.CreateFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -1763,7 +1862,8 @@ def test_get_feed(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetFeedRequest() + request = asset_service.GetFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -1791,6 +1891,32 @@ def test_get_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.GetFeedRequest() +@pytest.mark.asyncio +async def test_get_feed_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_feed), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + name='name_value', + asset_names=['asset_names_value'], + asset_types=['asset_types_value'], + content_type=asset_service.ContentType.RESOURCE, + relationship_types=['relationship_types_value'], + )) + response = await client.get_feed() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.GetFeedRequest() + @pytest.mark.asyncio async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetFeedRequest): client = AssetServiceAsyncClient( @@ -1819,7 +1945,8 @@ async def test_get_feed_async(transport: str = 'grpc_asyncio', request_type=asse # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetFeedRequest() + request = asset_service.GetFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -2006,7 +2133,8 @@ def test_list_feeds(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListFeedsRequest() + request = asset_service.ListFeedsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.ListFeedsResponse) @@ -2029,6 +2157,27 @@ def test_list_feeds_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListFeedsRequest() +@pytest.mark.asyncio +async def test_list_feeds_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_feeds), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListFeedsResponse( + )) + response = await client.list_feeds() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListFeedsRequest() + @pytest.mark.asyncio async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListFeedsRequest): client = AssetServiceAsyncClient( @@ -2052,7 +2201,8 @@ async def test_list_feeds_async(transport: str = 'grpc_asyncio', request_type=as # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListFeedsRequest() + request = asset_service.ListFeedsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.ListFeedsResponse) @@ -2239,7 +2389,8 @@ def test_update_feed(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateFeedRequest() + request = asset_service.UpdateFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -2267,6 +2418,32 @@ def test_update_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.UpdateFeedRequest() +@pytest.mark.asyncio +async def test_update_feed_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_feed), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + name='name_value', + asset_names=['asset_names_value'], + asset_types=['asset_types_value'], + content_type=asset_service.ContentType.RESOURCE, + relationship_types=['relationship_types_value'], + )) + response = await client.update_feed() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.UpdateFeedRequest() + @pytest.mark.asyncio async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateFeedRequest): client = AssetServiceAsyncClient( @@ -2295,7 +2472,8 @@ async def test_update_feed_async(transport: str = 'grpc_asyncio', request_type=a # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateFeedRequest() + request = asset_service.UpdateFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.Feed) @@ -2481,7 +2659,8 @@ def test_delete_feed(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteFeedRequest() + request = asset_service.DeleteFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2504,6 +2683,26 @@ def test_delete_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.DeleteFeedRequest() +@pytest.mark.asyncio +async def test_delete_feed_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_feed), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_feed() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.DeleteFeedRequest() + @pytest.mark.asyncio async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteFeedRequest): client = AssetServiceAsyncClient( @@ -2526,7 +2725,8 @@ async def test_delete_feed_async(transport: str = 'grpc_asyncio', request_type=a # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteFeedRequest() + request = asset_service.DeleteFeedRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2709,7 +2909,8 @@ def test_search_all_resources(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllResourcesRequest() + request = asset_service.SearchAllResourcesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.SearchAllResourcesPager) @@ -2733,6 +2934,28 @@ def test_search_all_resources_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.SearchAllResourcesRequest() +@pytest.mark.asyncio +async def test_search_all_resources_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_all_resources), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllResourcesResponse( + next_page_token='next_page_token_value', + )) + response = await client.search_all_resources() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.SearchAllResourcesRequest() + @pytest.mark.asyncio async def test_search_all_resources_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllResourcesRequest): client = AssetServiceAsyncClient( @@ -2757,7 +2980,8 @@ async def test_search_all_resources_async(transport: str = 'grpc_asyncio', reque # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllResourcesRequest() + request = asset_service.SearchAllResourcesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.SearchAllResourcesAsyncPager) @@ -3153,7 +3377,8 @@ def test_search_all_iam_policies(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllIamPoliciesRequest() + request = asset_service.SearchAllIamPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.SearchAllIamPoliciesPager) @@ -3177,6 +3402,28 @@ def test_search_all_iam_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.SearchAllIamPoliciesRequest() +@pytest.mark.asyncio +async def test_search_all_iam_policies_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_all_iam_policies), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllIamPoliciesResponse( + next_page_token='next_page_token_value', + )) + response = await client.search_all_iam_policies() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.SearchAllIamPoliciesRequest() + @pytest.mark.asyncio async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.SearchAllIamPoliciesRequest): client = AssetServiceAsyncClient( @@ -3201,7 +3448,8 @@ async def test_search_all_iam_policies_async(transport: str = 'grpc_asyncio', re # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.SearchAllIamPoliciesRequest() + request = asset_service.SearchAllIamPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.SearchAllIamPoliciesAsyncPager) @@ -3587,7 +3835,8 @@ def test_analyze_iam_policy(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyRequest() + request = asset_service.AnalyzeIamPolicyRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeIamPolicyResponse) @@ -3611,6 +3860,28 @@ def test_analyze_iam_policy_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeIamPolicyRequest() +@pytest.mark.asyncio +async def test_analyze_iam_policy_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeIamPolicyResponse( + fully_explored=True, + )) + response = await client.analyze_iam_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeIamPolicyRequest() + @pytest.mark.asyncio async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyRequest): client = AssetServiceAsyncClient( @@ -3635,7 +3906,8 @@ async def test_analyze_iam_policy_async(transport: str = 'grpc_asyncio', request # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyRequest() + request = asset_service.AnalyzeIamPolicyRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeIamPolicyResponse) @@ -3735,7 +4007,8 @@ def test_analyze_iam_policy_longrunning(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest() + request = asset_service.AnalyzeIamPolicyLongrunningRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3758,6 +4031,28 @@ def test_analyze_iam_policy_longrunning_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest() +@pytest.mark.asyncio +async def test_analyze_iam_policy_longrunning_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy_longrunning), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.analyze_iam_policy_longrunning() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest() + @pytest.mark.asyncio async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeIamPolicyLongrunningRequest): client = AssetServiceAsyncClient( @@ -3782,7 +4077,8 @@ async def test_analyze_iam_policy_longrunning_async(transport: str = 'grpc_async # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest() + request = asset_service.AnalyzeIamPolicyLongrunningRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3882,7 +4178,8 @@ def test_analyze_move(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeMoveRequest() + request = asset_service.AnalyzeMoveRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeMoveResponse) @@ -3905,6 +4202,27 @@ def test_analyze_move_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeMoveRequest() +@pytest.mark.asyncio +async def test_analyze_move_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_move), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeMoveResponse( + )) + response = await client.analyze_move() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeMoveRequest() + @pytest.mark.asyncio async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeMoveRequest): client = AssetServiceAsyncClient( @@ -3928,7 +4246,8 @@ async def test_analyze_move_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeMoveRequest() + request = asset_service.AnalyzeMoveRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.AnalyzeMoveResponse) @@ -4030,7 +4349,8 @@ def test_query_assets(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.QueryAssetsRequest() + request = asset_service.QueryAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.QueryAssetsResponse) @@ -4038,19 +4358,42 @@ def test_query_assets(request_type, transport: str = 'grpc'): assert response.done is True -def test_query_assets_empty_call(): +def test_query_assets_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.query_assets), + '__call__') as call: + client.query_assets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.QueryAssetsRequest() + +@pytest.mark.asyncio +async def test_query_assets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. - client = AssetServiceClient( + client = AssetServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport='grpc_asyncio', ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.query_assets), '__call__') as call: - client.query_assets() + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.QueryAssetsResponse( + job_reference='job_reference_value', + done=True, + )) + response = await client.query_assets() call.assert_called() _, args, _ = call.mock_calls[0] assert args[0] == asset_service.QueryAssetsRequest() @@ -4080,7 +4423,8 @@ async def test_query_assets_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.QueryAssetsRequest() + request = asset_service.QueryAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.QueryAssetsResponse) @@ -4186,7 +4530,8 @@ def test_create_saved_query(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateSavedQueryRequest() + request = asset_service.CreateSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -4213,6 +4558,31 @@ def test_create_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.CreateSavedQueryRequest() +@pytest.mark.asyncio +async def test_create_saved_query_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_saved_query), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + name='name_value', + description='description_value', + creator='creator_value', + last_updater='last_updater_value', + )) + response = await client.create_saved_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.CreateSavedQueryRequest() + @pytest.mark.asyncio async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.CreateSavedQueryRequest): client = AssetServiceAsyncClient( @@ -4240,7 +4610,8 @@ async def test_create_saved_query_async(transport: str = 'grpc_asyncio', request # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.CreateSavedQueryRequest() + request = asset_service.CreateSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -4450,7 +4821,8 @@ def test_get_saved_query(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetSavedQueryRequest() + request = asset_service.GetSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -4477,6 +4849,31 @@ def test_get_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.GetSavedQueryRequest() +@pytest.mark.asyncio +async def test_get_saved_query_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_saved_query), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + name='name_value', + description='description_value', + creator='creator_value', + last_updater='last_updater_value', + )) + response = await client.get_saved_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.GetSavedQueryRequest() + @pytest.mark.asyncio async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.GetSavedQueryRequest): client = AssetServiceAsyncClient( @@ -4504,7 +4901,8 @@ async def test_get_saved_query_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.GetSavedQueryRequest() + request = asset_service.GetSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -4691,7 +5089,8 @@ def test_list_saved_queries(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListSavedQueriesRequest() + request = asset_service.ListSavedQueriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListSavedQueriesPager) @@ -4715,6 +5114,28 @@ def test_list_saved_queries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListSavedQueriesRequest() +@pytest.mark.asyncio +async def test_list_saved_queries_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_saved_queries), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListSavedQueriesResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_saved_queries() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListSavedQueriesRequest() + @pytest.mark.asyncio async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request_type=asset_service.ListSavedQueriesRequest): client = AssetServiceAsyncClient( @@ -4739,7 +5160,8 @@ async def test_list_saved_queries_async(transport: str = 'grpc_asyncio', request # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.ListSavedQueriesRequest() + request = asset_service.ListSavedQueriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListSavedQueriesAsyncPager) @@ -5118,7 +5540,8 @@ def test_update_saved_query(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateSavedQueryRequest() + request = asset_service.UpdateSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -5145,6 +5568,31 @@ def test_update_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.UpdateSavedQueryRequest() +@pytest.mark.asyncio +async def test_update_saved_query_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_saved_query), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + name='name_value', + description='description_value', + creator='creator_value', + last_updater='last_updater_value', + )) + response = await client.update_saved_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.UpdateSavedQueryRequest() + @pytest.mark.asyncio async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.UpdateSavedQueryRequest): client = AssetServiceAsyncClient( @@ -5172,7 +5620,8 @@ async def test_update_saved_query_async(transport: str = 'grpc_asyncio', request # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.UpdateSavedQueryRequest() + request = asset_service.UpdateSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.SavedQuery) @@ -5367,7 +5816,8 @@ def test_delete_saved_query(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteSavedQueryRequest() + request = asset_service.DeleteSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -5390,6 +5840,26 @@ def test_delete_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.DeleteSavedQueryRequest() +@pytest.mark.asyncio +async def test_delete_saved_query_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_saved_query), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_saved_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.DeleteSavedQueryRequest() + @pytest.mark.asyncio async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request_type=asset_service.DeleteSavedQueryRequest): client = AssetServiceAsyncClient( @@ -5412,7 +5882,8 @@ async def test_delete_saved_query_async(transport: str = 'grpc_asyncio', request # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.DeleteSavedQueryRequest() + request = asset_service.DeleteSavedQueryRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -5594,7 +6065,8 @@ def test_batch_get_effective_iam_policies(request_type, transport: str = 'grpc') # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest() + request = asset_service.BatchGetEffectiveIamPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetEffectiveIamPoliciesResponse) @@ -5617,6 +6089,27 @@ def test_batch_get_effective_iam_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest() +@pytest.mark.asyncio +async def test_batch_get_effective_iam_policies_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_get_effective_iam_policies), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetEffectiveIamPoliciesResponse( + )) + response = await client.batch_get_effective_iam_policies() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest() + @pytest.mark.asyncio async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.BatchGetEffectiveIamPoliciesRequest): client = AssetServiceAsyncClient( @@ -5640,7 +6133,8 @@ async def test_batch_get_effective_iam_policies_async(transport: str = 'grpc_asy # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest() + request = asset_service.BatchGetEffectiveIamPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, asset_service.BatchGetEffectiveIamPoliciesResponse) @@ -5741,7 +6235,8 @@ def test_analyze_org_policies(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPoliciesRequest() + request = asset_service.AnalyzeOrgPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPoliciesPager) @@ -5765,6 +6260,28 @@ def test_analyze_org_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPoliciesRequest() +@pytest.mark.asyncio +async def test_analyze_org_policies_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policies), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPoliciesResponse( + next_page_token='next_page_token_value', + )) + response = await client.analyze_org_policies() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPoliciesRequest() + @pytest.mark.asyncio async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPoliciesRequest): client = AssetServiceAsyncClient( @@ -5789,7 +6306,8 @@ async def test_analyze_org_policies_async(transport: str = 'grpc_asyncio', reque # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPoliciesRequest() + request = asset_service.AnalyzeOrgPoliciesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPoliciesAsyncPager) @@ -6185,7 +6703,8 @@ def test_analyze_org_policy_governed_containers(request_type, transport: str = ' # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedContainersPager) @@ -6209,6 +6728,28 @@ def test_analyze_org_policy_governed_containers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest() +@pytest.mark.asyncio +async def test_analyze_org_policy_governed_containers_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policy_governed_containers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedContainersResponse( + next_page_token='next_page_token_value', + )) + response = await client.analyze_org_policy_governed_containers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + @pytest.mark.asyncio async def test_analyze_org_policy_governed_containers_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedContainersRequest): client = AssetServiceAsyncClient( @@ -6233,7 +6774,8 @@ async def test_analyze_org_policy_governed_containers_async(transport: str = 'gr # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedContainersAsyncPager) @@ -6629,7 +7171,8 @@ def test_analyze_org_policy_governed_assets(request_type, transport: str = 'grpc # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedAssetsPager) @@ -6653,6 +7196,28 @@ def test_analyze_org_policy_governed_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() +@pytest.mark.asyncio +async def test_analyze_org_policy_governed_assets_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AssetServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policy_governed_assets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedAssetsResponse( + next_page_token='next_page_token_value', + )) + response = await client.analyze_org_policy_governed_assets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + @pytest.mark.asyncio async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_asyncio', request_type=asset_service.AnalyzeOrgPolicyGovernedAssetsRequest): client = AssetServiceAsyncClient( @@ -6677,7 +7242,8 @@ async def test_analyze_org_policy_governed_assets_async(transport: str = 'grpc_a # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.AnalyzeOrgPolicyGovernedAssetsAsyncPager) 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 1d705928de..a89ae6b517 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 @@ -785,7 +785,8 @@ def test_generate_access_token(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateAccessTokenRequest() + request = common.GenerateAccessTokenRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.GenerateAccessTokenResponse) @@ -809,6 +810,28 @@ def test_generate_access_token_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.GenerateAccessTokenRequest() +@pytest.mark.asyncio +async def test_generate_access_token_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = IAMCredentialsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.generate_access_token), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateAccessTokenResponse( + access_token='access_token_value', + )) + response = await client.generate_access_token() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.GenerateAccessTokenRequest() + @pytest.mark.asyncio async def test_generate_access_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateAccessTokenRequest): client = IAMCredentialsAsyncClient( @@ -833,7 +856,8 @@ async def test_generate_access_token_async(transport: str = 'grpc_asyncio', requ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateAccessTokenRequest() + request = common.GenerateAccessTokenRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.GenerateAccessTokenResponse) @@ -1043,7 +1067,8 @@ def test_generate_id_token(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateIdTokenRequest() + request = common.GenerateIdTokenRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.GenerateIdTokenResponse) @@ -1067,6 +1092,28 @@ def test_generate_id_token_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.GenerateIdTokenRequest() +@pytest.mark.asyncio +async def test_generate_id_token_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = IAMCredentialsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.generate_id_token), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateIdTokenResponse( + token='token_value', + )) + response = await client.generate_id_token() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.GenerateIdTokenRequest() + @pytest.mark.asyncio async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_type=common.GenerateIdTokenRequest): client = IAMCredentialsAsyncClient( @@ -1091,7 +1138,8 @@ async def test_generate_id_token_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == common.GenerateIdTokenRequest() + request = common.GenerateIdTokenRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.GenerateIdTokenResponse) @@ -1306,7 +1354,8 @@ def test_sign_blob(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == common.SignBlobRequest() + request = common.SignBlobRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.SignBlobResponse) @@ -1331,6 +1380,29 @@ def test_sign_blob_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.SignBlobRequest() +@pytest.mark.asyncio +async def test_sign_blob_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = IAMCredentialsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.sign_blob), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.SignBlobResponse( + key_id='key_id_value', + signed_blob=b'signed_blob_blob', + )) + response = await client.sign_blob() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.SignBlobRequest() + @pytest.mark.asyncio async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=common.SignBlobRequest): client = IAMCredentialsAsyncClient( @@ -1356,7 +1428,8 @@ async def test_sign_blob_async(transport: str = 'grpc_asyncio', request_type=com # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == common.SignBlobRequest() + request = common.SignBlobRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.SignBlobResponse) @@ -1562,7 +1635,8 @@ def test_sign_jwt(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == common.SignJwtRequest() + request = common.SignJwtRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.SignJwtResponse) @@ -1587,6 +1661,29 @@ def test_sign_jwt_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.SignJwtRequest() +@pytest.mark.asyncio +async def test_sign_jwt_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = IAMCredentialsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.sign_jwt), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.SignJwtResponse( + key_id='key_id_value', + signed_jwt='signed_jwt_value', + )) + response = await client.sign_jwt() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.SignJwtRequest() + @pytest.mark.asyncio async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=common.SignJwtRequest): client = IAMCredentialsAsyncClient( @@ -1612,7 +1709,8 @@ async def test_sign_jwt_async(transport: str = 'grpc_asyncio', request_type=comm # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == common.SignJwtRequest() + request = common.SignJwtRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, common.SignJwtResponse) 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 a21c154713..520ccb53c3 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 @@ -809,7 +809,8 @@ def test_get_trigger(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetTriggerRequest() + request = eventarc.GetTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, trigger.Trigger) @@ -837,6 +838,32 @@ def test_get_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetTriggerRequest() +@pytest.mark.asyncio +async def test_get_trigger_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_trigger), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(trigger.Trigger( + name='name_value', + uid='uid_value', + service_account='service_account_value', + channel='channel_value', + etag='etag_value', + )) + response = await client.get_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetTriggerRequest() + @pytest.mark.asyncio async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetTriggerRequest): client = EventarcAsyncClient( @@ -865,7 +892,8 @@ async def test_get_trigger_async(transport: str = 'grpc_asyncio', request_type=e # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetTriggerRequest() + request = eventarc.GetTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, trigger.Trigger) @@ -1054,7 +1082,8 @@ def test_list_triggers(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListTriggersRequest() + request = eventarc.ListTriggersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListTriggersPager) @@ -1079,6 +1108,29 @@ def test_list_triggers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListTriggersRequest() +@pytest.mark.asyncio +async def test_list_triggers_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_triggers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListTriggersResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_triggers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListTriggersRequest() + @pytest.mark.asyncio async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListTriggersRequest): client = EventarcAsyncClient( @@ -1104,7 +1156,8 @@ async def test_list_triggers_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListTriggersRequest() + request = eventarc.ListTriggersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListTriggersAsyncPager) @@ -1479,7 +1532,8 @@ def test_create_trigger(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateTriggerRequest() + request = eventarc.CreateTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1502,6 +1556,28 @@ def test_create_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateTriggerRequest() +@pytest.mark.asyncio +async def test_create_trigger_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_trigger), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateTriggerRequest() + @pytest.mark.asyncio async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateTriggerRequest): client = EventarcAsyncClient( @@ -1526,7 +1602,8 @@ async def test_create_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateTriggerRequest() + request = eventarc.CreateTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1729,7 +1806,8 @@ def test_update_trigger(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateTriggerRequest() + request = eventarc.UpdateTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1752,6 +1830,28 @@ def test_update_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateTriggerRequest() +@pytest.mark.asyncio +async def test_update_trigger_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_trigger), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateTriggerRequest() + @pytest.mark.asyncio async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateTriggerRequest): client = EventarcAsyncClient( @@ -1776,7 +1876,8 @@ async def test_update_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateTriggerRequest() + request = eventarc.UpdateTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1979,7 +2080,8 @@ def test_delete_trigger(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteTriggerRequest() + request = eventarc.DeleteTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2002,6 +2104,28 @@ def test_delete_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteTriggerRequest() +@pytest.mark.asyncio +async def test_delete_trigger_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_trigger), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_trigger() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteTriggerRequest() + @pytest.mark.asyncio async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteTriggerRequest): client = EventarcAsyncClient( @@ -2026,7 +2150,8 @@ async def test_delete_trigger_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteTriggerRequest() + request = eventarc.DeleteTriggerRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2227,7 +2352,8 @@ def test_get_channel(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelRequest() + request = eventarc.GetChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, channel.Channel) @@ -2256,6 +2382,33 @@ def test_get_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetChannelRequest() +@pytest.mark.asyncio +async def test_get_channel_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel.Channel( + name='name_value', + uid='uid_value', + provider='provider_value', + state=channel.Channel.State.PENDING, + activation_token='activation_token_value', + crypto_key_name='crypto_key_name_value', + )) + response = await client.get_channel() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetChannelRequest() + @pytest.mark.asyncio async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelRequest): client = EventarcAsyncClient( @@ -2285,7 +2438,8 @@ async def test_get_channel_async(transport: str = 'grpc_asyncio', request_type=e # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelRequest() + request = eventarc.GetChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, channel.Channel) @@ -2475,7 +2629,8 @@ def test_list_channels(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelsRequest() + request = eventarc.ListChannelsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListChannelsPager) @@ -2500,6 +2655,29 @@ def test_list_channels_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListChannelsRequest() +@pytest.mark.asyncio +async def test_list_channels_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channels), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_channels() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListChannelsRequest() + @pytest.mark.asyncio async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelsRequest): client = EventarcAsyncClient( @@ -2525,7 +2703,8 @@ async def test_list_channels_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelsRequest() + request = eventarc.ListChannelsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListChannelsAsyncPager) @@ -2900,7 +3079,8 @@ def test_create_channel(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelRequest() + request = eventarc.CreateChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2923,6 +3103,28 @@ def test_create_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateChannelRequest() +@pytest.mark.asyncio +async def test_create_channel_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_channel() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateChannelRequest() + @pytest.mark.asyncio async def test_create_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelRequest): client = EventarcAsyncClient( @@ -2947,7 +3149,8 @@ async def test_create_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelRequest() + request = eventarc.CreateChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3150,7 +3353,8 @@ def test_update_channel(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateChannelRequest() + request = eventarc.UpdateChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3173,6 +3377,28 @@ def test_update_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateChannelRequest() +@pytest.mark.asyncio +async def test_update_channel_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_channel() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateChannelRequest() + @pytest.mark.asyncio async def test_update_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateChannelRequest): client = EventarcAsyncClient( @@ -3197,7 +3423,8 @@ async def test_update_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateChannelRequest() + request = eventarc.UpdateChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3390,7 +3617,8 @@ def test_delete_channel(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelRequest() + request = eventarc.DeleteChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3413,6 +3641,28 @@ def test_delete_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteChannelRequest() +@pytest.mark.asyncio +async def test_delete_channel_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_channel() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteChannelRequest() + @pytest.mark.asyncio async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelRequest): client = EventarcAsyncClient( @@ -3437,7 +3687,8 @@ async def test_delete_channel_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelRequest() + request = eventarc.DeleteChannelRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3623,7 +3874,8 @@ def test_get_provider(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetProviderRequest() + request = eventarc.GetProviderRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, discovery.Provider) @@ -3648,6 +3900,29 @@ def test_get_provider_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetProviderRequest() +@pytest.mark.asyncio +async def test_get_provider_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_provider), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(discovery.Provider( + name='name_value', + display_name='display_name_value', + )) + response = await client.get_provider() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetProviderRequest() + @pytest.mark.asyncio async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetProviderRequest): client = EventarcAsyncClient( @@ -3673,7 +3948,8 @@ async def test_get_provider_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetProviderRequest() + request = eventarc.GetProviderRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, discovery.Provider) @@ -3859,7 +4135,8 @@ def test_list_providers(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListProvidersRequest() + request = eventarc.ListProvidersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListProvidersPager) @@ -3884,6 +4161,29 @@ def test_list_providers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListProvidersRequest() +@pytest.mark.asyncio +async def test_list_providers_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_providers), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListProvidersResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_providers() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListProvidersRequest() + @pytest.mark.asyncio async def test_list_providers_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListProvidersRequest): client = EventarcAsyncClient( @@ -3909,7 +4209,8 @@ async def test_list_providers_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListProvidersRequest() + request = eventarc.ListProvidersRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListProvidersAsyncPager) @@ -4289,7 +4590,8 @@ def test_get_channel_connection(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelConnectionRequest() + request = eventarc.GetChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, channel_connection.ChannelConnection) @@ -4316,6 +4618,31 @@ def test_get_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetChannelConnectionRequest() +@pytest.mark.asyncio +async def test_get_channel_connection_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_connection.ChannelConnection( + name='name_value', + uid='uid_value', + channel='channel_value', + activation_token='activation_token_value', + )) + response = await client.get_channel_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetChannelConnectionRequest() + @pytest.mark.asyncio async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetChannelConnectionRequest): client = EventarcAsyncClient( @@ -4343,7 +4670,8 @@ async def test_get_channel_connection_async(transport: str = 'grpc_asyncio', req # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetChannelConnectionRequest() + request = eventarc.GetChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, channel_connection.ChannelConnection) @@ -4531,7 +4859,8 @@ def test_list_channel_connections(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelConnectionsRequest() + request = eventarc.ListChannelConnectionsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListChannelConnectionsPager) @@ -4556,6 +4885,29 @@ def test_list_channel_connections_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListChannelConnectionsRequest() +@pytest.mark.asyncio +async def test_list_channel_connections_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_connections), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelConnectionsResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_channel_connections() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListChannelConnectionsRequest() + @pytest.mark.asyncio async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', request_type=eventarc.ListChannelConnectionsRequest): client = EventarcAsyncClient( @@ -4581,7 +4933,8 @@ async def test_list_channel_connections_async(transport: str = 'grpc_asyncio', r # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.ListChannelConnectionsRequest() + request = eventarc.ListChannelConnectionsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListChannelConnectionsAsyncPager) @@ -4956,7 +5309,8 @@ def test_create_channel_connection(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelConnectionRequest() + request = eventarc.CreateChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -4979,6 +5333,28 @@ def test_create_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateChannelConnectionRequest() +@pytest.mark.asyncio +async def test_create_channel_connection_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_channel_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateChannelConnectionRequest() + @pytest.mark.asyncio async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.CreateChannelConnectionRequest): client = EventarcAsyncClient( @@ -5003,7 +5379,8 @@ async def test_create_channel_connection_async(transport: str = 'grpc_asyncio', # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.CreateChannelConnectionRequest() + request = eventarc.CreateChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5206,7 +5583,8 @@ def test_delete_channel_connection(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelConnectionRequest() + request = eventarc.DeleteChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5229,6 +5607,28 @@ def test_delete_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteChannelConnectionRequest() +@pytest.mark.asyncio +async def test_delete_channel_connection_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_connection), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_channel_connection() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteChannelConnectionRequest() + @pytest.mark.asyncio async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', request_type=eventarc.DeleteChannelConnectionRequest): client = EventarcAsyncClient( @@ -5253,7 +5653,8 @@ async def test_delete_channel_connection_async(transport: str = 'grpc_asyncio', # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.DeleteChannelConnectionRequest() + request = eventarc.DeleteChannelConnectionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5439,7 +5840,8 @@ def test_get_google_channel_config(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetGoogleChannelConfigRequest() + request = eventarc.GetGoogleChannelConfigRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, google_channel_config.GoogleChannelConfig) @@ -5464,6 +5866,29 @@ def test_get_google_channel_config_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetGoogleChannelConfigRequest() +@pytest.mark.asyncio +async def test_get_google_channel_config_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_google_channel_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(google_channel_config.GoogleChannelConfig( + name='name_value', + crypto_key_name='crypto_key_name_value', + )) + response = await client.get_google_channel_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetGoogleChannelConfigRequest() + @pytest.mark.asyncio async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.GetGoogleChannelConfigRequest): client = EventarcAsyncClient( @@ -5489,7 +5914,8 @@ async def test_get_google_channel_config_async(transport: str = 'grpc_asyncio', # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.GetGoogleChannelConfigRequest() + request = eventarc.GetGoogleChannelConfigRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, google_channel_config.GoogleChannelConfig) @@ -5675,7 +6101,8 @@ def test_update_google_channel_config(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() + request = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, gce_google_channel_config.GoogleChannelConfig) @@ -5700,6 +6127,29 @@ def test_update_google_channel_config_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() +@pytest.mark.asyncio +async def test_update_google_channel_config_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventarcAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_google_channel_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(gce_google_channel_config.GoogleChannelConfig( + name='name_value', + crypto_key_name='crypto_key_name_value', + )) + response = await client.update_google_channel_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() + @pytest.mark.asyncio async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio', request_type=eventarc.UpdateGoogleChannelConfigRequest): client = EventarcAsyncClient( @@ -5725,7 +6175,8 @@ async def test_update_google_channel_config_async(transport: str = 'grpc_asyncio # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() + request = eventarc.UpdateGoogleChannelConfigRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, gce_google_channel_config.GoogleChannelConfig) 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 34b89a6a4a..afdf694543 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 @@ -772,7 +772,8 @@ def test_list_buckets(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListBucketsRequest() + request = logging_config.ListBucketsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListBucketsPager) @@ -796,6 +797,28 @@ def test_list_buckets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListBucketsRequest() +@pytest.mark.asyncio +async def test_list_buckets_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_buckets), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListBucketsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_buckets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListBucketsRequest() + @pytest.mark.asyncio async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListBucketsRequest): client = ConfigServiceV2AsyncClient( @@ -820,7 +843,8 @@ async def test_list_buckets_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListBucketsRequest() + request = logging_config.ListBucketsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListBucketsAsyncPager) @@ -1202,7 +1226,8 @@ def test_get_bucket(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetBucketRequest() + request = logging_config.GetBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -1232,6 +1257,34 @@ def test_get_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetBucketRequest() +@pytest.mark.asyncio +async def test_get_bucket_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_bucket), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + name='name_value', + description='description_value', + retention_days=1512, + locked=True, + lifecycle_state=logging_config.LifecycleState.ACTIVE, + analytics_enabled=True, + restricted_fields=['restricted_fields_value'], + )) + response = await client.get_bucket() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetBucketRequest() + @pytest.mark.asyncio async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetBucketRequest): client = ConfigServiceV2AsyncClient( @@ -1262,7 +1315,8 @@ async def test_get_bucket_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetBucketRequest() + request = logging_config.GetBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -1368,7 +1422,8 @@ def test_create_bucket_async(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest() + request = logging_config.CreateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1391,6 +1446,28 @@ def test_create_bucket_async_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateBucketRequest() +@pytest.mark.asyncio +async def test_create_bucket_async_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_bucket_async), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_bucket_async() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateBucketRequest() + @pytest.mark.asyncio async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = ConfigServiceV2AsyncClient( @@ -1415,7 +1492,8 @@ async def test_create_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest() + request = logging_config.CreateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1514,7 +1592,8 @@ def test_update_bucket_async(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest() + request = logging_config.UpdateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1537,6 +1616,28 @@ def test_update_bucket_async_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateBucketRequest() +@pytest.mark.asyncio +async def test_update_bucket_async_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_bucket_async), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_bucket_async() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateBucketRequest() + @pytest.mark.asyncio async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = ConfigServiceV2AsyncClient( @@ -1561,7 +1662,8 @@ async def test_update_bucket_async_async(transport: str = 'grpc_asyncio', reques # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest() + request = logging_config.UpdateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1668,7 +1770,8 @@ def test_create_bucket(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest() + request = logging_config.CreateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -1698,6 +1801,34 @@ def test_create_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateBucketRequest() +@pytest.mark.asyncio +async def test_create_bucket_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_bucket), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + name='name_value', + description='description_value', + retention_days=1512, + locked=True, + lifecycle_state=logging_config.LifecycleState.ACTIVE, + analytics_enabled=True, + restricted_fields=['restricted_fields_value'], + )) + response = await client.create_bucket() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateBucketRequest() + @pytest.mark.asyncio async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateBucketRequest): client = ConfigServiceV2AsyncClient( @@ -1728,7 +1859,8 @@ async def test_create_bucket_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateBucketRequest() + request = logging_config.CreateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -1842,7 +1974,8 @@ def test_update_bucket(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest() + request = logging_config.UpdateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -1872,6 +2005,34 @@ def test_update_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateBucketRequest() +@pytest.mark.asyncio +async def test_update_bucket_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_bucket), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + name='name_value', + description='description_value', + retention_days=1512, + locked=True, + lifecycle_state=logging_config.LifecycleState.ACTIVE, + analytics_enabled=True, + restricted_fields=['restricted_fields_value'], + )) + response = await client.update_bucket() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateBucketRequest() + @pytest.mark.asyncio async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateBucketRequest): client = ConfigServiceV2AsyncClient( @@ -1902,7 +2063,8 @@ async def test_update_bucket_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateBucketRequest() + request = logging_config.UpdateBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogBucket) @@ -2008,7 +2170,8 @@ def test_delete_bucket(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteBucketRequest() + request = logging_config.DeleteBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2031,6 +2194,26 @@ def test_delete_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteBucketRequest() +@pytest.mark.asyncio +async def test_delete_bucket_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_bucket), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_bucket() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteBucketRequest() + @pytest.mark.asyncio async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteBucketRequest): client = ConfigServiceV2AsyncClient( @@ -2053,7 +2236,8 @@ async def test_delete_bucket_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteBucketRequest() + request = logging_config.DeleteBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2152,7 +2336,8 @@ def test_undelete_bucket(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UndeleteBucketRequest() + request = logging_config.UndeleteBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2175,6 +2360,26 @@ def test_undelete_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UndeleteBucketRequest() +@pytest.mark.asyncio +async def test_undelete_bucket_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_bucket), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.undelete_bucket() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UndeleteBucketRequest() + @pytest.mark.asyncio async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_type=logging_config.UndeleteBucketRequest): client = ConfigServiceV2AsyncClient( @@ -2197,7 +2402,8 @@ async def test_undelete_bucket_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UndeleteBucketRequest() + request = logging_config.UndeleteBucketRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2298,7 +2504,8 @@ def test_list_views(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListViewsRequest() + request = logging_config.ListViewsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListViewsPager) @@ -2322,6 +2529,28 @@ def test_list_views_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListViewsRequest() +@pytest.mark.asyncio +async def test_list_views_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_views), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListViewsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_views() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListViewsRequest() + @pytest.mark.asyncio async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListViewsRequest): client = ConfigServiceV2AsyncClient( @@ -2346,7 +2575,8 @@ async def test_list_views_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListViewsRequest() + request = logging_config.ListViewsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListViewsAsyncPager) @@ -2724,7 +2954,8 @@ def test_get_view(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetViewRequest() + request = logging_config.GetViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -2750,6 +2981,30 @@ def test_get_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetViewRequest() +@pytest.mark.asyncio +async def test_get_view_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_view), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + name='name_value', + description='description_value', + filter='filter_value', + )) + response = await client.get_view() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetViewRequest() + @pytest.mark.asyncio async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetViewRequest): client = ConfigServiceV2AsyncClient( @@ -2776,7 +3031,8 @@ async def test_get_view_async(transport: str = 'grpc_asyncio', request_type=logg # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetViewRequest() + request = logging_config.GetViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -2882,7 +3138,8 @@ def test_create_view(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateViewRequest() + request = logging_config.CreateViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -2908,6 +3165,30 @@ def test_create_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateViewRequest() +@pytest.mark.asyncio +async def test_create_view_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_view), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + name='name_value', + description='description_value', + filter='filter_value', + )) + response = await client.create_view() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateViewRequest() + @pytest.mark.asyncio async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateViewRequest): client = ConfigServiceV2AsyncClient( @@ -2934,7 +3215,8 @@ async def test_create_view_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateViewRequest() + request = logging_config.CreateViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -3040,7 +3322,8 @@ def test_update_view(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateViewRequest() + request = logging_config.UpdateViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -3066,6 +3349,30 @@ def test_update_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateViewRequest() +@pytest.mark.asyncio +async def test_update_view_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_view), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + name='name_value', + description='description_value', + filter='filter_value', + )) + response = await client.update_view() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateViewRequest() + @pytest.mark.asyncio async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateViewRequest): client = ConfigServiceV2AsyncClient( @@ -3092,7 +3399,8 @@ async def test_update_view_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateViewRequest() + request = logging_config.UpdateViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogView) @@ -3194,7 +3502,8 @@ def test_delete_view(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteViewRequest() + request = logging_config.DeleteViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -3217,6 +3526,26 @@ def test_delete_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteViewRequest() +@pytest.mark.asyncio +async def test_delete_view_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_view), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_view() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteViewRequest() + @pytest.mark.asyncio async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteViewRequest): client = ConfigServiceV2AsyncClient( @@ -3239,7 +3568,8 @@ async def test_delete_view_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteViewRequest() + request = logging_config.DeleteViewRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -3340,7 +3670,8 @@ def test_list_sinks(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListSinksRequest() + request = logging_config.ListSinksRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListSinksPager) @@ -3364,6 +3695,28 @@ def test_list_sinks_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListSinksRequest() +@pytest.mark.asyncio +async def test_list_sinks_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sinks), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListSinksResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_sinks() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListSinksRequest() + @pytest.mark.asyncio async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListSinksRequest): client = ConfigServiceV2AsyncClient( @@ -3388,7 +3741,8 @@ async def test_list_sinks_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListSinksRequest() + request = logging_config.ListSinksRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListSinksAsyncPager) @@ -3771,7 +4125,8 @@ def test_get_sink(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSinkRequest() + request = logging_config.GetSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -3802,6 +4157,35 @@ def test_get_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetSinkRequest() +@pytest.mark.asyncio +async def test_get_sink_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_sink), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + name='name_value', + destination='destination_value', + filter='filter_value', + description='description_value', + disabled=True, + output_version_format=logging_config.LogSink.VersionFormat.V2, + writer_identity='writer_identity_value', + include_children=True, + )) + response = await client.get_sink() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetSinkRequest() + @pytest.mark.asyncio async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSinkRequest): client = ConfigServiceV2AsyncClient( @@ -3833,7 +4217,8 @@ async def test_get_sink_async(transport: str = 'grpc_asyncio', request_type=logg # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSinkRequest() + request = logging_config.GetSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -4031,7 +4416,8 @@ def test_create_sink(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateSinkRequest() + request = logging_config.CreateSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -4062,6 +4448,35 @@ def test_create_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateSinkRequest() +@pytest.mark.asyncio +async def test_create_sink_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_sink), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + name='name_value', + destination='destination_value', + filter='filter_value', + description='description_value', + disabled=True, + output_version_format=logging_config.LogSink.VersionFormat.V2, + writer_identity='writer_identity_value', + include_children=True, + )) + response = await client.create_sink() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateSinkRequest() + @pytest.mark.asyncio async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateSinkRequest): client = ConfigServiceV2AsyncClient( @@ -4093,7 +4508,8 @@ async def test_create_sink_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateSinkRequest() + request = logging_config.CreateSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -4301,7 +4717,8 @@ def test_update_sink(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSinkRequest() + request = logging_config.UpdateSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -4332,6 +4749,35 @@ def test_update_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateSinkRequest() +@pytest.mark.asyncio +async def test_update_sink_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_sink), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + name='name_value', + destination='destination_value', + filter='filter_value', + description='description_value', + disabled=True, + output_version_format=logging_config.LogSink.VersionFormat.V2, + writer_identity='writer_identity_value', + include_children=True, + )) + response = await client.update_sink() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateSinkRequest() + @pytest.mark.asyncio async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSinkRequest): client = ConfigServiceV2AsyncClient( @@ -4363,7 +4809,8 @@ async def test_update_sink_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSinkRequest() + request = logging_config.UpdateSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogSink) @@ -4572,7 +5019,8 @@ def test_delete_sink(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest() + request = logging_config.DeleteSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -4595,6 +5043,26 @@ def test_delete_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteSinkRequest() +@pytest.mark.asyncio +async def test_delete_sink_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_sink), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_sink() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteSinkRequest() + @pytest.mark.asyncio async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteSinkRequest): client = ConfigServiceV2AsyncClient( @@ -4617,7 +5085,8 @@ async def test_delete_sink_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest() + request = logging_config.DeleteSinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -4798,7 +5267,8 @@ def test_create_link(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateLinkRequest() + request = logging_config.CreateLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -4821,6 +5291,28 @@ def test_create_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateLinkRequest() +@pytest.mark.asyncio +async def test_create_link_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateLinkRequest() + @pytest.mark.asyncio async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateLinkRequest): client = ConfigServiceV2AsyncClient( @@ -4845,7 +5337,8 @@ async def test_create_link_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateLinkRequest() + request = logging_config.CreateLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5048,7 +5541,8 @@ def test_delete_link(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteLinkRequest() + request = logging_config.DeleteLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5071,6 +5565,28 @@ def test_delete_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteLinkRequest() +@pytest.mark.asyncio +async def test_delete_link_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteLinkRequest() + @pytest.mark.asyncio async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteLinkRequest): client = ConfigServiceV2AsyncClient( @@ -5095,7 +5611,8 @@ async def test_delete_link_async(transport: str = 'grpc_asyncio', request_type=l # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteLinkRequest() + request = logging_config.DeleteLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -5280,7 +5797,8 @@ def test_list_links(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListLinksRequest() + request = logging_config.ListLinksRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLinksPager) @@ -5304,6 +5822,28 @@ def test_list_links_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListLinksRequest() +@pytest.mark.asyncio +async def test_list_links_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_links), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListLinksResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_links() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListLinksRequest() + @pytest.mark.asyncio async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=logging_config.ListLinksRequest): client = ConfigServiceV2AsyncClient( @@ -5328,7 +5868,8 @@ async def test_list_links_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListLinksRequest() + request = logging_config.ListLinksRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLinksAsyncPager) @@ -5706,7 +6247,8 @@ def test_get_link(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetLinkRequest() + request = logging_config.GetLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Link) @@ -5732,6 +6274,30 @@ def test_get_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetLinkRequest() +@pytest.mark.asyncio +async def test_get_link_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_link), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Link( + name='name_value', + description='description_value', + lifecycle_state=logging_config.LifecycleState.ACTIVE, + )) + response = await client.get_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetLinkRequest() + @pytest.mark.asyncio async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetLinkRequest): client = ConfigServiceV2AsyncClient( @@ -5758,7 +6324,8 @@ async def test_get_link_async(transport: str = 'grpc_asyncio', request_type=logg # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetLinkRequest() + request = logging_config.GetLinkRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Link) @@ -5944,26 +6511,49 @@ def test_list_exclusions(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] + request = logging_config.ListExclusionsRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListExclusionsPager) + assert response.next_page_token == 'next_page_token_value' + + +def test_list_exclusions_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_exclusions), + '__call__') as call: + client.list_exclusions() + call.assert_called() + _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListExclusionsRequest() - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListExclusionsPager) - assert response.next_page_token == 'next_page_token_value' - - -def test_list_exclusions_empty_call(): +@pytest.mark.asyncio +async def test_list_exclusions_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. - client = ConfigServiceV2Client( + client = ConfigServiceV2AsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', + transport='grpc_asyncio', ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.list_exclusions), '__call__') as call: - client.list_exclusions() + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListExclusionsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_exclusions() call.assert_called() _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListExclusionsRequest() @@ -5992,7 +6582,8 @@ async def test_list_exclusions_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.ListExclusionsRequest() + request = logging_config.ListExclusionsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListExclusionsAsyncPager) @@ -6371,7 +6962,8 @@ def test_get_exclusion(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetExclusionRequest() + request = logging_config.GetExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -6398,6 +6990,31 @@ def test_get_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetExclusionRequest() +@pytest.mark.asyncio +async def test_get_exclusion_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_exclusion), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + name='name_value', + description='description_value', + filter='filter_value', + disabled=True, + )) + response = await client.get_exclusion() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetExclusionRequest() + @pytest.mark.asyncio async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetExclusionRequest): client = ConfigServiceV2AsyncClient( @@ -6425,7 +7042,8 @@ async def test_get_exclusion_async(transport: str = 'grpc_asyncio', request_type # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetExclusionRequest() + request = logging_config.GetExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -6615,7 +7233,8 @@ def test_create_exclusion(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateExclusionRequest() + request = logging_config.CreateExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -6642,6 +7261,31 @@ def test_create_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateExclusionRequest() +@pytest.mark.asyncio +async def test_create_exclusion_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_exclusion), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + name='name_value', + description='description_value', + filter='filter_value', + disabled=True, + )) + response = await client.create_exclusion() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateExclusionRequest() + @pytest.mark.asyncio async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.CreateExclusionRequest): client = ConfigServiceV2AsyncClient( @@ -6669,7 +7313,8 @@ async def test_create_exclusion_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CreateExclusionRequest() + request = logging_config.CreateExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -6869,7 +7514,8 @@ def test_update_exclusion(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateExclusionRequest() + request = logging_config.UpdateExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -6896,6 +7542,31 @@ def test_update_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateExclusionRequest() +@pytest.mark.asyncio +async def test_update_exclusion_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_exclusion), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + name='name_value', + description='description_value', + filter='filter_value', + disabled=True, + )) + response = await client.update_exclusion() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateExclusionRequest() + @pytest.mark.asyncio async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateExclusionRequest): client = ConfigServiceV2AsyncClient( @@ -6923,7 +7594,8 @@ async def test_update_exclusion_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateExclusionRequest() + request = logging_config.UpdateExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.LogExclusion) @@ -7128,7 +7800,8 @@ def test_delete_exclusion(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteExclusionRequest() + request = logging_config.DeleteExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -7151,6 +7824,26 @@ def test_delete_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteExclusionRequest() +@pytest.mark.asyncio +async def test_delete_exclusion_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_exclusion), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_exclusion() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteExclusionRequest() + @pytest.mark.asyncio async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_type=logging_config.DeleteExclusionRequest): client = ConfigServiceV2AsyncClient( @@ -7173,7 +7866,8 @@ async def test_delete_exclusion_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteExclusionRequest() + request = logging_config.DeleteExclusionRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -7359,7 +8053,8 @@ def test_get_cmek_settings(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetCmekSettingsRequest() + request = logging_config.GetCmekSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.CmekSettings) @@ -7386,6 +8081,31 @@ def test_get_cmek_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetCmekSettingsRequest() +@pytest.mark.asyncio +async def test_get_cmek_settings_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cmek_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( + name='name_value', + kms_key_name='kms_key_name_value', + kms_key_version_name='kms_key_version_name_value', + service_account_id='service_account_id_value', + )) + response = await client.get_cmek_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetCmekSettingsRequest() + @pytest.mark.asyncio async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetCmekSettingsRequest): client = ConfigServiceV2AsyncClient( @@ -7413,7 +8133,8 @@ async def test_get_cmek_settings_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetCmekSettingsRequest() + request = logging_config.GetCmekSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.CmekSettings) @@ -7521,7 +8242,8 @@ def test_update_cmek_settings(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateCmekSettingsRequest() + request = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.CmekSettings) @@ -7548,6 +8270,31 @@ def test_update_cmek_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateCmekSettingsRequest() +@pytest.mark.asyncio +async def test_update_cmek_settings_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cmek_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( + name='name_value', + kms_key_name='kms_key_name_value', + kms_key_version_name='kms_key_version_name_value', + service_account_id='service_account_id_value', + )) + response = await client.update_cmek_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateCmekSettingsRequest() + @pytest.mark.asyncio async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateCmekSettingsRequest): client = ConfigServiceV2AsyncClient( @@ -7575,7 +8322,8 @@ async def test_update_cmek_settings_async(transport: str = 'grpc_asyncio', reque # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateCmekSettingsRequest() + request = logging_config.UpdateCmekSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.CmekSettings) @@ -7684,7 +8432,8 @@ def test_get_settings(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSettingsRequest() + request = logging_config.GetSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Settings) @@ -7712,6 +8461,32 @@ def test_get_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetSettingsRequest() +@pytest.mark.asyncio +async def test_get_settings_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( + name='name_value', + kms_key_name='kms_key_name_value', + kms_service_account_id='kms_service_account_id_value', + storage_location='storage_location_value', + disable_default_sink=True, + )) + response = await client.get_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetSettingsRequest() + @pytest.mark.asyncio async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.GetSettingsRequest): client = ConfigServiceV2AsyncClient( @@ -7740,7 +8515,8 @@ async def test_get_settings_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.GetSettingsRequest() + request = logging_config.GetSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Settings) @@ -7932,7 +8708,8 @@ def test_update_settings(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSettingsRequest() + request = logging_config.UpdateSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Settings) @@ -7960,6 +8737,32 @@ def test_update_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateSettingsRequest() +@pytest.mark.asyncio +async def test_update_settings_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_settings), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( + name='name_value', + kms_key_name='kms_key_name_value', + kms_service_account_id='kms_service_account_id_value', + storage_location='storage_location_value', + disable_default_sink=True, + )) + response = await client.update_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateSettingsRequest() + @pytest.mark.asyncio async def test_update_settings_async(transport: str = 'grpc_asyncio', request_type=logging_config.UpdateSettingsRequest): client = ConfigServiceV2AsyncClient( @@ -7988,7 +8791,8 @@ async def test_update_settings_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.UpdateSettingsRequest() + request = logging_config.UpdateSettingsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_config.Settings) @@ -8184,7 +8988,8 @@ def test_copy_log_entries(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CopyLogEntriesRequest() + request = logging_config.CopyLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -8207,6 +9012,28 @@ def test_copy_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CopyLogEntriesRequest() +@pytest.mark.asyncio +async def test_copy_log_entries_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.copy_log_entries), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.copy_log_entries() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CopyLogEntriesRequest() + @pytest.mark.asyncio async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging_config.CopyLogEntriesRequest): client = ConfigServiceV2AsyncClient( @@ -8231,7 +9058,8 @@ async def test_copy_log_entries_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.CopyLogEntriesRequest() + request = logging_config.CopyLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) 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 d4c9a11686..2c56407ad1 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 @@ -772,7 +772,8 @@ def test_delete_log(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging.DeleteLogRequest() + request = logging.DeleteLogRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -795,6 +796,26 @@ def test_delete_log_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.DeleteLogRequest() +@pytest.mark.asyncio +async def test_delete_log_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = LoggingServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_log), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_log() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.DeleteLogRequest() + @pytest.mark.asyncio async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=logging.DeleteLogRequest): client = LoggingServiceV2AsyncClient( @@ -817,7 +838,8 @@ async def test_delete_log_async(transport: str = 'grpc_asyncio', request_type=lo # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging.DeleteLogRequest() + request = logging.DeleteLogRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -999,7 +1021,8 @@ def test_write_log_entries(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging.WriteLogEntriesRequest() + request = logging.WriteLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging.WriteLogEntriesResponse) @@ -1022,6 +1045,27 @@ def test_write_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.WriteLogEntriesRequest() +@pytest.mark.asyncio +async def test_write_log_entries_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = LoggingServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.write_log_entries), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.WriteLogEntriesResponse( + )) + response = await client.write_log_entries() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.WriteLogEntriesRequest() + @pytest.mark.asyncio async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.WriteLogEntriesRequest): client = LoggingServiceV2AsyncClient( @@ -1045,7 +1089,8 @@ async def test_write_log_entries_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging.WriteLogEntriesRequest() + request = logging.WriteLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging.WriteLogEntriesResponse) @@ -1195,7 +1240,8 @@ def test_list_log_entries(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogEntriesRequest() + request = logging.ListLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogEntriesPager) @@ -1219,6 +1265,28 @@ def test_list_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListLogEntriesRequest() +@pytest.mark.asyncio +async def test_list_log_entries_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = LoggingServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_log_entries), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogEntriesResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_log_entries() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListLogEntriesRequest() + @pytest.mark.asyncio async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogEntriesRequest): client = LoggingServiceV2AsyncClient( @@ -1243,7 +1311,8 @@ async def test_list_log_entries_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogEntriesRequest() + request = logging.ListLogEntriesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogEntriesAsyncPager) @@ -1571,7 +1640,8 @@ def test_list_monitored_resource_descriptors(request_type, transport: str = 'grp # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListMonitoredResourceDescriptorsRequest() + request = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListMonitoredResourceDescriptorsPager) @@ -1595,6 +1665,28 @@ def test_list_monitored_resource_descriptors_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListMonitoredResourceDescriptorsRequest() +@pytest.mark.asyncio +async def test_list_monitored_resource_descriptors_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = LoggingServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_monitored_resource_descriptors), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListMonitoredResourceDescriptorsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_monitored_resource_descriptors() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListMonitoredResourceDescriptorsRequest() + @pytest.mark.asyncio async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_asyncio', request_type=logging.ListMonitoredResourceDescriptorsRequest): client = LoggingServiceV2AsyncClient( @@ -1619,7 +1711,8 @@ async def test_list_monitored_resource_descriptors_async(transport: str = 'grpc_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListMonitoredResourceDescriptorsRequest() + request = logging.ListMonitoredResourceDescriptorsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListMonitoredResourceDescriptorsAsyncPager) @@ -1846,7 +1939,8 @@ def test_list_logs(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogsRequest() + request = logging.ListLogsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogsPager) @@ -1871,6 +1965,29 @@ def test_list_logs_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListLogsRequest() +@pytest.mark.asyncio +async def test_list_logs_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = LoggingServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_logs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogsResponse( + log_names=['log_names_value'], + next_page_token='next_page_token_value', + )) + response = await client.list_logs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListLogsRequest() + @pytest.mark.asyncio async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=logging.ListLogsRequest): client = LoggingServiceV2AsyncClient( @@ -1896,7 +2013,8 @@ async def test_list_logs_async(transport: str = 'grpc_asyncio', request_type=log # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging.ListLogsRequest() + request = logging.ListLogsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogsAsyncPager) 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 70a02b72fd..5367494ddc 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 @@ -772,7 +772,8 @@ def test_list_log_metrics(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.ListLogMetricsRequest() + request = logging_metrics.ListLogMetricsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogMetricsPager) @@ -796,6 +797,28 @@ def test_list_log_metrics_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.ListLogMetricsRequest() +@pytest.mark.asyncio +async def test_list_log_metrics_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = MetricsServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_log_metrics), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.ListLogMetricsResponse( + next_page_token='next_page_token_value', + )) + response = await client.list_log_metrics() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.ListLogMetricsRequest() + @pytest.mark.asyncio async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.ListLogMetricsRequest): client = MetricsServiceV2AsyncClient( @@ -820,7 +843,8 @@ async def test_list_log_metrics_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.ListLogMetricsRequest() + request = logging_metrics.ListLogMetricsRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListLogMetricsAsyncPager) @@ -1202,7 +1226,8 @@ def test_get_log_metric(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.GetLogMetricRequest() + request = logging_metrics.GetLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1232,6 +1257,34 @@ def test_get_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.GetLogMetricRequest() +@pytest.mark.asyncio +async def test_get_log_metric_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = MetricsServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_log_metric), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + name='name_value', + description='description_value', + filter='filter_value', + bucket_name='bucket_name_value', + disabled=True, + value_extractor='value_extractor_value', + version=logging_metrics.LogMetric.ApiVersion.V1, + )) + response = await client.get_log_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.GetLogMetricRequest() + @pytest.mark.asyncio async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.GetLogMetricRequest): client = MetricsServiceV2AsyncClient( @@ -1262,7 +1315,8 @@ async def test_get_log_metric_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.GetLogMetricRequest() + request = logging_metrics.GetLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1458,7 +1512,8 @@ def test_create_log_metric(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.CreateLogMetricRequest() + request = logging_metrics.CreateLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1488,6 +1543,34 @@ def test_create_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.CreateLogMetricRequest() +@pytest.mark.asyncio +async def test_create_log_metric_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = MetricsServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_log_metric), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + name='name_value', + description='description_value', + filter='filter_value', + bucket_name='bucket_name_value', + disabled=True, + value_extractor='value_extractor_value', + version=logging_metrics.LogMetric.ApiVersion.V1, + )) + response = await client.create_log_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.CreateLogMetricRequest() + @pytest.mark.asyncio async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.CreateLogMetricRequest): client = MetricsServiceV2AsyncClient( @@ -1518,7 +1601,8 @@ async def test_create_log_metric_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.CreateLogMetricRequest() + request = logging_metrics.CreateLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1724,7 +1808,8 @@ def test_update_log_metric(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.UpdateLogMetricRequest() + request = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1754,6 +1839,34 @@ def test_update_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.UpdateLogMetricRequest() +@pytest.mark.asyncio +async def test_update_log_metric_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = MetricsServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_log_metric), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + name='name_value', + description='description_value', + filter='filter_value', + bucket_name='bucket_name_value', + disabled=True, + value_extractor='value_extractor_value', + version=logging_metrics.LogMetric.ApiVersion.V1, + )) + response = await client.update_log_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.UpdateLogMetricRequest() + @pytest.mark.asyncio async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.UpdateLogMetricRequest): client = MetricsServiceV2AsyncClient( @@ -1784,7 +1897,8 @@ async def test_update_log_metric_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.UpdateLogMetricRequest() + request = logging_metrics.UpdateLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, logging_metrics.LogMetric) @@ -1982,7 +2096,8 @@ def test_delete_log_metric(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.DeleteLogMetricRequest() + request = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None @@ -2005,6 +2120,26 @@ def test_delete_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.DeleteLogMetricRequest() +@pytest.mark.asyncio +async def test_delete_log_metric_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = MetricsServiceV2AsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_log_metric), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_log_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.DeleteLogMetricRequest() + @pytest.mark.asyncio async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_type=logging_metrics.DeleteLogMetricRequest): client = MetricsServiceV2AsyncClient( @@ -2027,7 +2162,8 @@ async def test_delete_log_metric_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == logging_metrics.DeleteLogMetricRequest() + request = logging_metrics.DeleteLogMetricRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert response is None 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 10552af147..57b5388f83 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 @@ -797,7 +797,8 @@ def test_list_instances(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ListInstancesRequest() + request = cloud_redis.ListInstancesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListInstancesPager) @@ -822,6 +823,29 @@ def test_list_instances_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ListInstancesRequest() +@pytest.mark.asyncio +async def test_list_instances_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_instances), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.ListInstancesResponse( + next_page_token='next_page_token_value', + unreachable=['unreachable_value'], + )) + response = await client.list_instances() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ListInstancesRequest() + @pytest.mark.asyncio async def test_list_instances_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ListInstancesRequest): client = CloudRedisAsyncClient( @@ -847,7 +871,8 @@ async def test_list_instances_async(transport: str = 'grpc_asyncio', request_typ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ListInstancesRequest() + request = cloud_redis.ListInstancesRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListInstancesAsyncPager) @@ -1250,7 +1275,8 @@ def test_get_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceRequest() + request = cloud_redis.GetInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, cloud_redis.Instance) @@ -1300,6 +1326,54 @@ def test_get_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.GetInstanceRequest() +@pytest.mark.asyncio +async def test_get_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.Instance( + name='name_value', + display_name='display_name_value', + location_id='location_id_value', + alternative_location_id='alternative_location_id_value', + redis_version='redis_version_value', + reserved_ip_range='reserved_ip_range_value', + secondary_ip_range='secondary_ip_range_value', + host='host_value', + port=453, + current_location_id='current_location_id_value', + state=cloud_redis.Instance.State.CREATING, + status_message='status_message_value', + tier=cloud_redis.Instance.Tier.BASIC, + memory_size_gb=1499, + authorized_network='authorized_network_value', + persistence_iam_identity='persistence_iam_identity_value', + connect_mode=cloud_redis.Instance.ConnectMode.DIRECT_PEERING, + auth_enabled=True, + transit_encryption_mode=cloud_redis.Instance.TransitEncryptionMode.SERVER_AUTHENTICATION, + replica_count=1384, + read_endpoint='read_endpoint_value', + read_endpoint_port=1920, + read_replicas_mode=cloud_redis.Instance.ReadReplicasMode.READ_REPLICAS_DISABLED, + customer_managed_key='customer_managed_key_value', + suspension_reasons=[cloud_redis.Instance.SuspensionReason.CUSTOMER_MANAGED_KEY_ISSUE], + maintenance_version='maintenance_version_value', + available_maintenance_versions=['available_maintenance_versions_value'], + )) + response = await client.get_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.GetInstanceRequest() + @pytest.mark.asyncio async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceRequest): client = CloudRedisAsyncClient( @@ -1350,7 +1424,8 @@ async def test_get_instance_async(transport: str = 'grpc_asyncio', request_type= # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceRequest() + request = cloud_redis.GetInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, cloud_redis.Instance) @@ -1560,7 +1635,8 @@ def test_get_instance_auth_string(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceAuthStringRequest() + request = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, cloud_redis.InstanceAuthString) @@ -1584,6 +1660,28 @@ def test_get_instance_auth_string_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.GetInstanceAuthStringRequest() +@pytest.mark.asyncio +async def test_get_instance_auth_string_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_instance_auth_string), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.InstanceAuthString( + auth_string='auth_string_value', + )) + response = await client.get_instance_auth_string() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.GetInstanceAuthStringRequest() + @pytest.mark.asyncio async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.GetInstanceAuthStringRequest): client = CloudRedisAsyncClient( @@ -1608,7 +1706,8 @@ async def test_get_instance_auth_string_async(transport: str = 'grpc_asyncio', r # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.GetInstanceAuthStringRequest() + request = cloud_redis.GetInstanceAuthStringRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, cloud_redis.InstanceAuthString) @@ -1790,7 +1889,8 @@ def test_create_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.CreateInstanceRequest() + request = cloud_redis.CreateInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -1813,6 +1913,28 @@ def test_create_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.CreateInstanceRequest() +@pytest.mark.asyncio +async def test_create_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.create_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.CreateInstanceRequest() + @pytest.mark.asyncio async def test_create_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.CreateInstanceRequest): client = CloudRedisAsyncClient( @@ -1837,7 +1959,8 @@ async def test_create_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.CreateInstanceRequest() + request = cloud_redis.CreateInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2040,7 +2163,8 @@ def test_update_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpdateInstanceRequest() + request = cloud_redis.UpdateInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2063,6 +2187,28 @@ def test_update_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.UpdateInstanceRequest() +@pytest.mark.asyncio +async def test_update_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.update_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.UpdateInstanceRequest() + @pytest.mark.asyncio async def test_update_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpdateInstanceRequest): client = CloudRedisAsyncClient( @@ -2087,7 +2233,8 @@ async def test_update_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpdateInstanceRequest() + request = cloud_redis.UpdateInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2280,7 +2427,8 @@ def test_upgrade_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpgradeInstanceRequest() + request = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2303,6 +2451,28 @@ def test_upgrade_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.UpgradeInstanceRequest() +@pytest.mark.asyncio +async def test_upgrade_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.upgrade_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.upgrade_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.UpgradeInstanceRequest() + @pytest.mark.asyncio async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.UpgradeInstanceRequest): client = CloudRedisAsyncClient( @@ -2327,7 +2497,8 @@ async def test_upgrade_instance_async(transport: str = 'grpc_asyncio', request_t # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.UpgradeInstanceRequest() + request = cloud_redis.UpgradeInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2520,7 +2691,8 @@ def test_import_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ImportInstanceRequest() + request = cloud_redis.ImportInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2543,6 +2715,28 @@ def test_import_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ImportInstanceRequest() +@pytest.mark.asyncio +async def test_import_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.import_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ImportInstanceRequest() + @pytest.mark.asyncio async def test_import_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ImportInstanceRequest): client = CloudRedisAsyncClient( @@ -2567,7 +2761,8 @@ async def test_import_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ImportInstanceRequest() + request = cloud_redis.ImportInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2760,7 +2955,8 @@ def test_export_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ExportInstanceRequest() + request = cloud_redis.ExportInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -2783,6 +2979,28 @@ def test_export_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ExportInstanceRequest() +@pytest.mark.asyncio +async def test_export_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.export_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.export_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ExportInstanceRequest() + @pytest.mark.asyncio async def test_export_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.ExportInstanceRequest): client = CloudRedisAsyncClient( @@ -2807,7 +3025,8 @@ async def test_export_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.ExportInstanceRequest() + request = cloud_redis.ExportInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3000,7 +3219,8 @@ def test_failover_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.FailoverInstanceRequest() + request = cloud_redis.FailoverInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3023,6 +3243,28 @@ def test_failover_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.FailoverInstanceRequest() +@pytest.mark.asyncio +async def test_failover_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.failover_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.failover_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.FailoverInstanceRequest() + @pytest.mark.asyncio async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.FailoverInstanceRequest): client = CloudRedisAsyncClient( @@ -3047,7 +3289,8 @@ async def test_failover_instance_async(transport: str = 'grpc_asyncio', request_ # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.FailoverInstanceRequest() + request = cloud_redis.FailoverInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3240,7 +3483,8 @@ def test_delete_instance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.DeleteInstanceRequest() + request = cloud_redis.DeleteInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3263,6 +3507,28 @@ def test_delete_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.DeleteInstanceRequest() +@pytest.mark.asyncio +async def test_delete_instance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_instance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.delete_instance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.DeleteInstanceRequest() + @pytest.mark.asyncio async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.DeleteInstanceRequest): client = CloudRedisAsyncClient( @@ -3287,7 +3553,8 @@ async def test_delete_instance_async(transport: str = 'grpc_asyncio', request_ty # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.DeleteInstanceRequest() + request = cloud_redis.DeleteInstanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3470,7 +3737,8 @@ def test_reschedule_maintenance(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.RescheduleMaintenanceRequest() + request = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) @@ -3493,6 +3761,28 @@ def test_reschedule_maintenance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.RescheduleMaintenanceRequest() +@pytest.mark.asyncio +async def test_reschedule_maintenance_empty_call_async(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CloudRedisAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.reschedule_maintenance), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + response = await client.reschedule_maintenance() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.RescheduleMaintenanceRequest() + @pytest.mark.asyncio async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', request_type=cloud_redis.RescheduleMaintenanceRequest): client = CloudRedisAsyncClient( @@ -3517,7 +3807,8 @@ async def test_reschedule_maintenance_async(transport: str = 'grpc_asyncio', req # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == cloud_redis.RescheduleMaintenanceRequest() + request = cloud_redis.RescheduleMaintenanceRequest() + assert args[0] == request # Establish that the response is the type that we expect. assert isinstance(response, future.Future) diff --git a/tests/system/test_unary.py b/tests/system/test_unary.py index 076771ed30..e09d5911ec 100644 --- a/tests/system/test_unary.py +++ b/tests/system/test_unary.py @@ -14,6 +14,7 @@ import os import pytest +import re from google.api_core import exceptions from google.rpc import code_pb2 @@ -24,15 +25,48 @@ def test_unary_with_request_object(echo): response = echo.echo(showcase.EchoRequest( content='The hail in Wales falls mainly on the snails.', + request_id='some_value', )) assert response.content == 'The hail in Wales falls mainly on the snails.' + assert response.request_id == 'some_value' + + # Repeat the same test but this time without `request_id`` set + # The `request_id` field should be automatically populated with + # a UUID4 value if it is not set. + # See https://google.aip.dev/client-libraries/4235 + response = echo.echo(showcase.EchoRequest( + content='The hail in Wales falls mainly on the snails.', + )) + assert response.content == 'The hail in Wales falls mainly on the snails.' + # Ensure that the uuid4 field is set according to AIP 4235 + re.match( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", + response.request_id, + ) + assert len(response.request_id) == 36 def test_unary_with_dict(echo): + response = echo.echo({ + 'content': 'The hail in Wales falls mainly on the snails.', + 'request_id': 'some_value', + }) + assert response.content == 'The hail in Wales falls mainly on the snails.' + assert response.request_id == 'some_value' + + # Repeat the same test but this time without `request_id`` set + # The `request_id` field should be automatically populated with + # a UUID4 value if it is not set. + # See https://google.aip.dev/client-libraries/4235 response = echo.echo({ 'content': 'The hail in Wales falls mainly on the snails.', }) assert response.content == 'The hail in Wales falls mainly on the snails.' + re.match( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", + response.request_id, + ) + assert len(response.request_id) == 36 def test_unary_error(echo): From dcce56de7a59401fc620d51e44ca8c82c7c50814 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 20 Mar 2024 19:58:26 +0000 Subject: [PATCH 02/14] add missing assert --- tests/system/test_unary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/test_unary.py b/tests/system/test_unary.py index e09d5911ec..f8759554c9 100644 --- a/tests/system/test_unary.py +++ b/tests/system/test_unary.py @@ -39,7 +39,7 @@ def test_unary_with_request_object(echo): )) assert response.content == 'The hail in Wales falls mainly on the snails.' # Ensure that the uuid4 field is set according to AIP 4235 - re.match( + assert re.match( r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", response.request_id, ) @@ -62,7 +62,7 @@ def test_unary_with_dict(echo): 'content': 'The hail in Wales falls mainly on the snails.', }) assert response.content == 'The hail in Wales falls mainly on the snails.' - re.match( + assert re.match( r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", response.request_id, ) From 92383c832af3e93f4a35719efefecafaae4f9c67 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 20 Mar 2024 21:28:39 +0000 Subject: [PATCH 03/14] add test case for explicit presence --- .github/workflows/tests.yaml | 2 +- noxfile.py | 2 +- tests/system/test_unary.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 354aff4a57..e8a914f0e7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - SHOWCASE_VERSION: 0.31.0 + SHOWCASE_VERSION: 0.32.0 PROTOC_VERSION: 3.20.2 jobs: diff --git a/noxfile.py b/noxfile.py index 8aa70a8021..a7e49ac432 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,7 +29,7 @@ nox.options.error_on_missing_interpreters = True -showcase_version = os.environ.get("SHOWCASE_VERSION", "0.31.0") +showcase_version = os.environ.get("SHOWCASE_VERSION", "0.32.0") ADS_TEMPLATES = path.join(path.dirname(__file__), "gapic", "ads-templates") diff --git a/tests/system/test_unary.py b/tests/system/test_unary.py index f8759554c9..35cc297d16 100644 --- a/tests/system/test_unary.py +++ b/tests/system/test_unary.py @@ -26,9 +26,11 @@ def test_unary_with_request_object(echo): response = echo.echo(showcase.EchoRequest( content='The hail in Wales falls mainly on the snails.', request_id='some_value', + other_request_id='', )) assert response.content == 'The hail in Wales falls mainly on the snails.' assert response.request_id == 'some_value' + assert response.other_request_id == '' # Repeat the same test but this time without `request_id`` set # The `request_id` field should be automatically populated with @@ -44,15 +46,23 @@ def test_unary_with_request_object(echo): response.request_id, ) assert len(response.request_id) == 36 + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", + response.other_request_id, + ) + assert len(response.other_request_id) == 36 def test_unary_with_dict(echo): response = echo.echo({ 'content': 'The hail in Wales falls mainly on the snails.', 'request_id': 'some_value', + 'other_request_id': '', }) assert response.content == 'The hail in Wales falls mainly on the snails.' assert response.request_id == 'some_value' + assert response.other_request_id == '' # Repeat the same test but this time without `request_id`` set # The `request_id` field should be automatically populated with @@ -67,6 +77,12 @@ def test_unary_with_dict(echo): response.request_id, ) assert len(response.request_id) == 36 + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match( + r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", + response.other_request_id, + ) + assert len(response.other_request_id) == 36 def test_unary_error(echo): From 6bff6d8bda7b7f84dc269e44e5d496c468a0694e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 09:39:05 +0000 Subject: [PATCH 04/14] set default argument of jinja-filters.map() when looking up attributes --- .../%name/%version/%sub/services/%service/client.py.j2 | 2 +- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../%name_%version/%sub/services/%service/async_client.py.j2 | 2 +- .../%name_%version/%sub/services/%service/client.py.j2 | 2 +- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- setup.py | 5 ++++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 index e68268bb38..28c6f53cdc 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 @@ -6,7 +6,7 @@ from collections import OrderedDict import os import re from typing import Callable, Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} import uuid {% endif %} {% if service.any_deprecated %} diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 980afbfebc..1c67a92c49 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -3,7 +3,7 @@ {% block content %} import os -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} import re {% endif %} # try/except added for compatibility with python < 3.8 diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index d0c1daee9b..f52ecdd985 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -7,7 +7,7 @@ from collections import OrderedDict import functools import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} import uuid {% endif %} {% if service.any_deprecated %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index 62fcc94e29..26ee86e3e0 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -10,7 +10,7 @@ import functools import os import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} import uuid {% endif %} import warnings diff --git a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 6f150c25ae..27573b4641 100644 --- a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -4,7 +4,7 @@ {% import "tests/unit/gapic/%name_%version/%sub/test_macros.j2" as test_macros %} import os -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} import re {% endif %} # try/except added for compatibility with python < 3.8 diff --git a/setup.py b/setup.py index 2b243db842..a1e65f71b7 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,10 @@ "google-api-core[grpc] >= 1.34.1, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "googleapis-common-protos >= 1.55.0", "grpcio >= 1.24.3", - "jinja2 >= 2.10", + # 2.11.0 is required which adds the `default` argument to `jinja-filters.map()` + # https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.map + # https://jinja.palletsprojects.com/en/2.11.x/changelog/#version-2-11-0 + "jinja2 >= 2.11", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "pypandoc >= 1.4", "PyYAML >= 5.1.1", From 108ad38668d1b736cb0b8a44c93af0d226ca64bd Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 09:43:18 +0000 Subject: [PATCH 05/14] use correct default --- .../%name/%version/%sub/services/%service/client.py.j2 | 2 +- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../%name_%version/%sub/services/%service/async_client.py.j2 | 2 +- .../%name_%version/%sub/services/%service/client.py.j2 | 2 +- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 index 28c6f53cdc..17c78e5845 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 @@ -6,7 +6,7 @@ from collections import OrderedDict import os import re from typing import Callable, Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} import uuid {% endif %} {% if service.any_deprecated %} diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 1c67a92c49..cf9b1c3942 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -3,7 +3,7 @@ {% block content %} import os -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} import re {% endif %} # try/except added for compatibility with python < 3.8 diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index f52ecdd985..de18fb5c2a 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -7,7 +7,7 @@ from collections import OrderedDict import functools import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} import uuid {% endif %} {% if service.any_deprecated %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 index 26ee86e3e0..ddeca38627 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2 @@ -10,7 +10,7 @@ import functools import os import re from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, {% if service.any_server_streaming %}Iterable, {% endif %}{% if service.any_client_streaming %}Iterator, {% endif %}Sequence, Tuple, Type, Union, cast -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} import uuid {% endif %} import warnings diff --git a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 27573b4641..ebc96487a1 100644 --- a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -4,7 +4,7 @@ {% import "tests/unit/gapic/%name_%version/%sub/test_macros.j2" as test_macros %} import os -{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default="")|list %} +{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %} import re {% endif %} # try/except added for compatibility with python < 3.8 From 8bb4496ae83ca66776b841646a6b9e7b0afed6d0 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 09:51:14 +0000 Subject: [PATCH 06/14] grammar --- .../%name/%version/%sub/services/%service/client.py.j2 | 4 ++-- .../%name_%version/%sub/services/%service/_client_macros.j2 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 index 17c78e5845..aff47ad913 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2 @@ -477,8 +477,8 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta): {% endif %} {# - Automatically populate UUID4 fields according to AIP-4235 - (https://google.aip.dev/client-libraries/4235) if the + Automatically populate UUID4 fields according to + https://google.aip.dev/client-libraries/4235 when the field satisfies either of: - The field supports explicit presence and has not been set by the user. - The field doesn't support explicit presence, and its value is the empty diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 index 7b64f02162..5d751f1c80 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 @@ -270,8 +270,8 @@ {% macro auto_populate_uuid4_fields(api, method) %} {# - Automatically populate UUID4 fields according to AIP-4235 - (https://google.aip.dev/client-libraries/4235) if the + Automatically populate UUID4 fields according to + https://google.aip.dev/client-libraries/4235 when the field satisfies either of: - The field supports explicit presence and has not been set by the user. - The field doesn't support explicit presence, and its value is the empty From 1c042c015847f1b2baf71c2ff5762851e586d1d1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 10:30:41 +0000 Subject: [PATCH 07/14] add unit test to ensure that UUID4 are populated in non-empty requests --- .../%name_%version/%sub/test_%service.py.j2 | 41 + .../gapic/%name_%version/%sub/test_macros.j2 | 41 + .../unit/gapic/asset_v1/test_asset_service.py | 665 +++++++++++++ .../credentials_v1/test_iam_credentials.py | 112 +++ .../unit/gapic/eventarc_v1/test_eventarc.py | 506 ++++++++++ .../logging_v2/test_config_service_v2.py | 906 +++++++++++++++++- .../logging_v2/test_logging_service_v2.py | 141 +++ .../logging_v2/test_metrics_service_v2.py | 137 +++ .../unit/gapic/redis_v1/test_cloud_redis.py | 301 ++++++ 9 files changed, 2840 insertions(+), 10 deletions(-) diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index cf9b1c3942..7601ac9037 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -664,6 +664,47 @@ def test_{{ method_name }}_empty_call(): {% endwith %}{# method_settings #} assert args[0] == {{ method.input.ident }}() {% endif %} + + +def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = {{ service.client_name }}( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.{{ method.transport_safe_name|snake_case }}), + '__call__') as call: + client.{{ method_name }}(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] +{% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} +{% if method_settings is not none %} +{% for auto_populated_field in method_settings.auto_populated_fields %} + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None +{% endfor %} +{% endif %}{# if method_settings is not none #} +{% endwith %}{# method_settings #} + assert args[0] == {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) {% endif %} 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 70749c88e2..e78d4acf85 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 @@ -150,6 +150,47 @@ def test_{{ method_name }}_empty_call(): {% endwith %}{# method_settings #} assert args[0] == {{ method.input.ident }}() {% endif %} + + +def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that UUID4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = {{ service.client_name }}( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically + # if they meet the requirements of AIP 4235. + request = {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.{{ method.transport_safe_name|snake_case }}), + '__call__') as call: + client.{{ method_name }}(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] +{% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} +{% if method_settings is not none %} +{% for auto_populated_field in method_settings.auto_populated_fields %} + # Ensure that the uuid4 field is set according to AIP 4235 + assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + # clear UUID field so that the check below succeeds + args[0].{{ auto_populated_field }} = None +{% endfor %} +{% endif %}{# if method_settings is not none #} +{% endwith %}{# method_settings #} + assert args[0] == {{ method.input.ident }}( + {% for field in method.input.fields.values() if field.ident|string() == "str" and not field.uuid4 %} + {{ field.name }}={{ field.mock_value }}, + {% endfor %} + ) {% endif %} {% if not full_extended_lro %} 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 c1b4b5645d..30061e753d 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 @@ -817,6 +817,33 @@ def test_export_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ExportAssetsRequest() + +def test_export_assets_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.ExportAssetsRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.export_assets), + '__call__') as call: + client.export_assets(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ExportAssetsRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_export_assets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -990,6 +1017,35 @@ def test_list_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListAssetsRequest() + +def test_list_assets_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.ListAssetsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_assets), + '__call__') as call: + client.list_assets(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListAssetsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_assets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1436,6 +1492,33 @@ def test_batch_get_assets_history_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.BatchGetAssetsHistoryRequest() + +def test_batch_get_assets_history_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.BatchGetAssetsHistoryRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_get_assets_history), + '__call__') as call: + client.batch_get_assets_history(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.BatchGetAssetsHistoryRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_batch_get_assets_history_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1615,6 +1698,35 @@ def test_create_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.CreateFeedRequest() + +def test_create_feed_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.CreateFeedRequest( + parent='parent_value', + feed_id='feed_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_feed), + '__call__') as call: + client.create_feed(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.CreateFeedRequest( + parent='parent_value', + feed_id='feed_id_value', + ) + @pytest.mark.asyncio async def test_create_feed_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1891,6 +2003,33 @@ def test_get_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.GetFeedRequest() + +def test_get_feed_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.GetFeedRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_feed), + '__call__') as call: + client.get_feed(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.GetFeedRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_feed_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2157,6 +2296,33 @@ def test_list_feeds_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListFeedsRequest() + +def test_list_feeds_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.ListFeedsRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_feeds), + '__call__') as call: + client.list_feeds(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListFeedsRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_list_feeds_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2418,6 +2584,31 @@ def test_update_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.UpdateFeedRequest() + +def test_update_feed_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.UpdateFeedRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_feed), + '__call__') as call: + client.update_feed(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.UpdateFeedRequest( + ) + @pytest.mark.asyncio async def test_update_feed_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2683,6 +2874,33 @@ def test_delete_feed_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.DeleteFeedRequest() + +def test_delete_feed_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.DeleteFeedRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_feed), + '__call__') as call: + client.delete_feed(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.DeleteFeedRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_feed_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2934,6 +3152,39 @@ def test_search_all_resources_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.SearchAllResourcesRequest() + +def test_search_all_resources_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.SearchAllResourcesRequest( + scope='scope_value', + query='query_value', + page_token='page_token_value', + order_by='order_by_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_all_resources), + '__call__') as call: + client.search_all_resources(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.SearchAllResourcesRequest( + scope='scope_value', + query='query_value', + page_token='page_token_value', + order_by='order_by_value', + ) + @pytest.mark.asyncio async def test_search_all_resources_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3402,6 +3653,39 @@ def test_search_all_iam_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.SearchAllIamPoliciesRequest() + +def test_search_all_iam_policies_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.SearchAllIamPoliciesRequest( + scope='scope_value', + query='query_value', + page_token='page_token_value', + order_by='order_by_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_all_iam_policies), + '__call__') as call: + client.search_all_iam_policies(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.SearchAllIamPoliciesRequest( + scope='scope_value', + query='query_value', + page_token='page_token_value', + order_by='order_by_value', + ) + @pytest.mark.asyncio async def test_search_all_iam_policies_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3860,6 +4144,33 @@ def test_analyze_iam_policy_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeIamPolicyRequest() + +def test_analyze_iam_policy_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeIamPolicyRequest( + saved_analysis_query='saved_analysis_query_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy), + '__call__') as call: + client.analyze_iam_policy(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeIamPolicyRequest( + saved_analysis_query='saved_analysis_query_value', + ) + @pytest.mark.asyncio async def test_analyze_iam_policy_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4031,6 +4342,33 @@ def test_analyze_iam_policy_longrunning_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest() + +def test_analyze_iam_policy_longrunning_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeIamPolicyLongrunningRequest( + saved_analysis_query='saved_analysis_query_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_iam_policy_longrunning), + '__call__') as call: + client.analyze_iam_policy_longrunning(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeIamPolicyLongrunningRequest( + saved_analysis_query='saved_analysis_query_value', + ) + @pytest.mark.asyncio async def test_analyze_iam_policy_longrunning_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4202,6 +4540,35 @@ def test_analyze_move_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeMoveRequest() + +def test_analyze_move_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeMoveRequest( + resource='resource_value', + destination_parent='destination_parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_move), + '__call__') as call: + client.analyze_move(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeMoveRequest( + resource='resource_value', + destination_parent='destination_parent_value', + ) + @pytest.mark.asyncio async def test_analyze_move_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4375,6 +4742,39 @@ def test_query_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.QueryAssetsRequest() + +def test_query_assets_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.QueryAssetsRequest( + parent='parent_value', + statement='statement_value', + job_reference='job_reference_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.query_assets), + '__call__') as call: + client.query_assets(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.QueryAssetsRequest( + parent='parent_value', + statement='statement_value', + job_reference='job_reference_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_query_assets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4558,6 +4958,35 @@ def test_create_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.CreateSavedQueryRequest() + +def test_create_saved_query_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.CreateSavedQueryRequest( + parent='parent_value', + saved_query_id='saved_query_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_saved_query), + '__call__') as call: + client.create_saved_query(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.CreateSavedQueryRequest( + parent='parent_value', + saved_query_id='saved_query_id_value', + ) + @pytest.mark.asyncio async def test_create_saved_query_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4849,6 +5278,33 @@ def test_get_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.GetSavedQueryRequest() + +def test_get_saved_query_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.GetSavedQueryRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_saved_query), + '__call__') as call: + client.get_saved_query(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.GetSavedQueryRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_saved_query_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5114,6 +5570,37 @@ def test_list_saved_queries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.ListSavedQueriesRequest() + +def test_list_saved_queries_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.ListSavedQueriesRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_saved_queries), + '__call__') as call: + client.list_saved_queries(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.ListSavedQueriesRequest( + parent='parent_value', + filter='filter_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_saved_queries_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5568,6 +6055,31 @@ def test_update_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.UpdateSavedQueryRequest() + +def test_update_saved_query_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.UpdateSavedQueryRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_saved_query), + '__call__') as call: + client.update_saved_query(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.UpdateSavedQueryRequest( + ) + @pytest.mark.asyncio async def test_update_saved_query_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5840,6 +6352,33 @@ def test_delete_saved_query_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.DeleteSavedQueryRequest() + +def test_delete_saved_query_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.DeleteSavedQueryRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_saved_query), + '__call__') as call: + client.delete_saved_query(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.DeleteSavedQueryRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_saved_query_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6089,6 +6628,33 @@ def test_batch_get_effective_iam_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest() + +def test_batch_get_effective_iam_policies_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.BatchGetEffectiveIamPoliciesRequest( + scope='scope_value', + ) + + # Mock the actual call within the gRPC stub, 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=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.BatchGetEffectiveIamPoliciesRequest( + scope='scope_value', + ) + @pytest.mark.asyncio async def test_batch_get_effective_iam_policies_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6260,6 +6826,39 @@ def test_analyze_org_policies_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPoliciesRequest() + +def test_analyze_org_policies_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeOrgPoliciesRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.analyze_org_policies), + '__call__') as call: + client.analyze_org_policies(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPoliciesRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_analyze_org_policies_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6728,6 +7327,39 @@ def test_analyze_org_policy_governed_containers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest() + +def test_analyze_org_policy_governed_containers_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, 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=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedContainersRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_analyze_org_policy_governed_containers_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -7196,6 +7828,39 @@ def test_analyze_org_policy_governed_assets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest() + +def test_analyze_org_policy_governed_assets_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = AssetServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, 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=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( + scope='scope_value', + constraint='constraint_value', + filter='filter_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_analyze_org_policy_governed_assets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 a89ae6b517..13d86b4c6b 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 @@ -810,6 +810,33 @@ def test_generate_access_token_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.GenerateAccessTokenRequest() + +def test_generate_access_token_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = common.GenerateAccessTokenRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.generate_access_token), + '__call__') as call: + client.generate_access_token(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.GenerateAccessTokenRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_generate_access_token_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1092,6 +1119,35 @@ def test_generate_id_token_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.GenerateIdTokenRequest() + +def test_generate_id_token_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = common.GenerateIdTokenRequest( + name='name_value', + audience='audience_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.generate_id_token), + '__call__') as call: + client.generate_id_token(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.GenerateIdTokenRequest( + name='name_value', + audience='audience_value', + ) + @pytest.mark.asyncio async def test_generate_id_token_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1380,6 +1436,33 @@ def test_sign_blob_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.SignBlobRequest() + +def test_sign_blob_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = common.SignBlobRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.sign_blob), + '__call__') as call: + client.sign_blob(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.SignBlobRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_sign_blob_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1661,6 +1744,35 @@ def test_sign_jwt_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == common.SignJwtRequest() + +def test_sign_jwt_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = IAMCredentialsClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = common.SignJwtRequest( + name='name_value', + payload='payload_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.sign_jwt), + '__call__') as call: + client.sign_jwt(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == common.SignJwtRequest( + name='name_value', + payload='payload_value', + ) + @pytest.mark.asyncio async def test_sign_jwt_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 520ccb53c3..2729c0e94d 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 @@ -838,6 +838,33 @@ def test_get_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetTriggerRequest() + +def test_get_trigger_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.GetTriggerRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_trigger), + '__call__') as call: + client.get_trigger(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetTriggerRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_trigger_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1108,6 +1135,39 @@ def test_list_triggers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListTriggersRequest() + +def test_list_triggers_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.ListTriggersRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + filter='filter_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_triggers), + '__call__') as call: + client.list_triggers(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListTriggersRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + filter='filter_value', + ) + @pytest.mark.asyncio async def test_list_triggers_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1556,6 +1616,35 @@ def test_create_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateTriggerRequest() + +def test_create_trigger_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.CreateTriggerRequest( + parent='parent_value', + trigger_id='trigger_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_trigger), + '__call__') as call: + client.create_trigger(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateTriggerRequest( + parent='parent_value', + trigger_id='trigger_id_value', + ) + @pytest.mark.asyncio async def test_create_trigger_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1830,6 +1919,31 @@ def test_update_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateTriggerRequest() + +def test_update_trigger_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.UpdateTriggerRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_trigger), + '__call__') as call: + client.update_trigger(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateTriggerRequest( + ) + @pytest.mark.asyncio async def test_update_trigger_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2104,6 +2218,35 @@ def test_delete_trigger_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteTriggerRequest() + +def test_delete_trigger_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.DeleteTriggerRequest( + name='name_value', + etag='etag_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_trigger), + '__call__') as call: + client.delete_trigger(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteTriggerRequest( + name='name_value', + etag='etag_value', + ) + @pytest.mark.asyncio async def test_delete_trigger_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2382,6 +2525,33 @@ def test_get_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetChannelRequest() + +def test_get_channel_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.GetChannelRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel), + '__call__') as call: + client.get_channel(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetChannelRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_channel_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2655,6 +2825,37 @@ def test_list_channels_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListChannelsRequest() + +def test_list_channels_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.ListChannelsRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channels), + '__call__') as call: + client.list_channels(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListChannelsRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + ) + @pytest.mark.asyncio async def test_list_channels_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3103,6 +3304,35 @@ def test_create_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateChannelRequest() + +def test_create_channel_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.CreateChannelRequest( + parent='parent_value', + channel_id='channel_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_), + '__call__') as call: + client.create_channel(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateChannelRequest( + parent='parent_value', + channel_id='channel_id_value', + ) + @pytest.mark.asyncio async def test_create_channel_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3377,6 +3607,31 @@ def test_update_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateChannelRequest() + +def test_update_channel_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.UpdateChannelRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_channel), + '__call__') as call: + client.update_channel(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateChannelRequest( + ) + @pytest.mark.asyncio async def test_update_channel_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3641,6 +3896,33 @@ def test_delete_channel_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteChannelRequest() + +def test_delete_channel_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.DeleteChannelRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel), + '__call__') as call: + client.delete_channel(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteChannelRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_channel_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3900,6 +4182,33 @@ def test_get_provider_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetProviderRequest() + +def test_get_provider_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.GetProviderRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_provider), + '__call__') as call: + client.get_provider(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetProviderRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_provider_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4161,6 +4470,39 @@ def test_list_providers_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListProvidersRequest() + +def test_list_providers_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.ListProvidersRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + filter='filter_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_providers), + '__call__') as call: + client.list_providers(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListProvidersRequest( + parent='parent_value', + page_token='page_token_value', + order_by='order_by_value', + filter='filter_value', + ) + @pytest.mark.asyncio async def test_list_providers_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4618,6 +4960,33 @@ def test_get_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetChannelConnectionRequest() + +def test_get_channel_connection_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.GetChannelConnectionRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_channel_connection), + '__call__') as call: + client.get_channel_connection(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetChannelConnectionRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_channel_connection_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4885,6 +5254,35 @@ def test_list_channel_connections_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.ListChannelConnectionsRequest() + +def test_list_channel_connections_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.ListChannelConnectionsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_connections), + '__call__') as call: + client.list_channel_connections(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.ListChannelConnectionsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_channel_connections_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5333,6 +5731,35 @@ def test_create_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.CreateChannelConnectionRequest() + +def test_create_channel_connection_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.CreateChannelConnectionRequest( + parent='parent_value', + channel_connection_id='channel_connection_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_channel_connection), + '__call__') as call: + client.create_channel_connection(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.CreateChannelConnectionRequest( + parent='parent_value', + channel_connection_id='channel_connection_id_value', + ) + @pytest.mark.asyncio async def test_create_channel_connection_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5607,6 +6034,33 @@ def test_delete_channel_connection_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.DeleteChannelConnectionRequest() + +def test_delete_channel_connection_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.DeleteChannelConnectionRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_channel_connection), + '__call__') as call: + client.delete_channel_connection(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.DeleteChannelConnectionRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_channel_connection_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5866,6 +6320,33 @@ def test_get_google_channel_config_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.GetGoogleChannelConfigRequest() + +def test_get_google_channel_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.GetGoogleChannelConfigRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_google_channel_config), + '__call__') as call: + client.get_google_channel_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.GetGoogleChannelConfigRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_google_channel_config_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6127,6 +6608,31 @@ def test_update_google_channel_config_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == eventarc.UpdateGoogleChannelConfigRequest() + +def test_update_google_channel_config_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = EventarcClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = eventarc.UpdateGoogleChannelConfigRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_google_channel_config), + '__call__') as call: + client.update_google_channel_config(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == eventarc.UpdateGoogleChannelConfigRequest( + ) + @pytest.mark.asyncio async def test_update_google_channel_config_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 afdf694543..19287ef3a4 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 @@ -797,6 +797,35 @@ def test_list_buckets_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListBucketsRequest() + +def test_list_buckets_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.ListBucketsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_buckets), + '__call__') as call: + client.list_buckets(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListBucketsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_buckets_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1257,6 +1286,33 @@ def test_get_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetBucketRequest() + +def test_get_bucket_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetBucketRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_bucket), + '__call__') as call: + client.get_bucket(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetBucketRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_bucket_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1446,6 +1502,35 @@ def test_create_bucket_async_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateBucketRequest() + +def test_create_bucket_async_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateBucketRequest( + parent='parent_value', + bucket_id='bucket_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_bucket_async), + '__call__') as call: + client.create_bucket_async(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateBucketRequest( + parent='parent_value', + bucket_id='bucket_id_value', + ) + @pytest.mark.asyncio async def test_create_bucket_async_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1616,6 +1701,33 @@ def test_update_bucket_async_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateBucketRequest() + +def test_update_bucket_async_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateBucketRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_bucket_async), + '__call__') as call: + client.update_bucket_async(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateBucketRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_bucket_async_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1801,6 +1913,35 @@ def test_create_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateBucketRequest() + +def test_create_bucket_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateBucketRequest( + parent='parent_value', + bucket_id='bucket_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_bucket), + '__call__') as call: + client.create_bucket(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateBucketRequest( + parent='parent_value', + bucket_id='bucket_id_value', + ) + @pytest.mark.asyncio async def test_create_bucket_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2005,6 +2146,33 @@ def test_update_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateBucketRequest() + +def test_update_bucket_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateBucketRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_bucket), + '__call__') as call: + client.update_bucket(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateBucketRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_bucket_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2194,6 +2362,33 @@ def test_delete_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteBucketRequest() + +def test_delete_bucket_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.DeleteBucketRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_bucket), + '__call__') as call: + client.delete_bucket(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteBucketRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_bucket_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2360,6 +2555,33 @@ def test_undelete_bucket_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UndeleteBucketRequest() + +def test_undelete_bucket_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UndeleteBucketRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_bucket), + '__call__') as call: + client.undelete_bucket(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UndeleteBucketRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_undelete_bucket_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2529,6 +2751,35 @@ def test_list_views_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListViewsRequest() + +def test_list_views_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.ListViewsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_views), + '__call__') as call: + client.list_views(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListViewsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_views_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2981,6 +3232,33 @@ def test_get_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetViewRequest() + +def test_get_view_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetViewRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_view), + '__call__') as call: + client.get_view(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetViewRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_view_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3165,6 +3443,35 @@ def test_create_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateViewRequest() + +def test_create_view_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateViewRequest( + parent='parent_value', + view_id='view_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_view), + '__call__') as call: + client.create_view(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateViewRequest( + parent='parent_value', + view_id='view_id_value', + ) + @pytest.mark.asyncio async def test_create_view_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3349,6 +3656,33 @@ def test_update_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateViewRequest() + +def test_update_view_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateViewRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_view), + '__call__') as call: + client.update_view(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateViewRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_view_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3526,6 +3860,33 @@ def test_delete_view_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteViewRequest() + +def test_delete_view_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.DeleteViewRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_view), + '__call__') as call: + client.delete_view(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteViewRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_view_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3695,6 +4056,35 @@ def test_list_sinks_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListSinksRequest() + +def test_list_sinks_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.ListSinksRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sinks), + '__call__') as call: + client.list_sinks(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListSinksRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_sinks_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4157,6 +4547,33 @@ def test_get_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetSinkRequest() + +def test_get_sink_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetSinkRequest( + sink_name='sink_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_sink), + '__call__') as call: + client.get_sink(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetSinkRequest( + sink_name='sink_name_value', + ) + @pytest.mark.asyncio async def test_get_sink_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4448,6 +4865,33 @@ def test_create_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateSinkRequest() + +def test_create_sink_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateSinkRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_sink), + '__call__') as call: + client.create_sink(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateSinkRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_create_sink_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -4749,6 +5193,33 @@ def test_update_sink_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateSinkRequest() + +def test_update_sink_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateSinkRequest( + sink_name='sink_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_sink), + '__call__') as call: + client.update_sink(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateSinkRequest( + sink_name='sink_name_value', + ) + @pytest.mark.asyncio async def test_update_sink_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5019,29 +5490,56 @@ def test_delete_sink(request_type, transport: str = 'grpc'): # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - request = logging_config.DeleteSinkRequest() - assert args[0] == request - - # Establish that the response is the type that we expect. - assert response is None + request = logging_config.DeleteSinkRequest() + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_sink_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_sink), + '__call__') as call: + client.delete_sink() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteSinkRequest() -def test_delete_sink_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_delete_sink_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.DeleteSinkRequest( + sink_name='sink_name_value', + ) + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.delete_sink), '__call__') as call: - client.delete_sink() + client.delete_sink(request=request) call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == logging_config.DeleteSinkRequest() + assert args[0] == logging_config.DeleteSinkRequest( + sink_name='sink_name_value', + ) @pytest.mark.asyncio async def test_delete_sink_empty_call_async(): @@ -5291,6 +5789,35 @@ def test_create_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateLinkRequest() + +def test_create_link_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateLinkRequest( + parent='parent_value', + link_id='link_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_link), + '__call__') as call: + client.create_link(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateLinkRequest( + parent='parent_value', + link_id='link_id_value', + ) + @pytest.mark.asyncio async def test_create_link_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5565,6 +6092,33 @@ def test_delete_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteLinkRequest() + +def test_delete_link_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.DeleteLinkRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_link), + '__call__') as call: + client.delete_link(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteLinkRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_link_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -5822,6 +6376,35 @@ def test_list_links_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListLinksRequest() + +def test_list_links_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.ListLinksRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_links), + '__call__') as call: + client.list_links(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListLinksRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_links_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6274,6 +6857,33 @@ def test_get_link_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetLinkRequest() + +def test_get_link_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetLinkRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_link), + '__call__') as call: + client.get_link(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetLinkRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_link_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6536,6 +7146,35 @@ def test_list_exclusions_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.ListExclusionsRequest() + +def test_list_exclusions_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.ListExclusionsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_exclusions), + '__call__') as call: + client.list_exclusions(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.ListExclusionsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_exclusions_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -6990,6 +7629,33 @@ def test_get_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetExclusionRequest() + +def test_get_exclusion_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetExclusionRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_exclusion), + '__call__') as call: + client.get_exclusion(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetExclusionRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_exclusion_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -7261,6 +7927,33 @@ def test_create_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CreateExclusionRequest() + +def test_create_exclusion_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CreateExclusionRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_exclusion), + '__call__') as call: + client.create_exclusion(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CreateExclusionRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_create_exclusion_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -7542,6 +8235,33 @@ def test_update_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateExclusionRequest() + +def test_update_exclusion_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateExclusionRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_exclusion), + '__call__') as call: + client.update_exclusion(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateExclusionRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_exclusion_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -7824,6 +8544,33 @@ def test_delete_exclusion_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.DeleteExclusionRequest() + +def test_delete_exclusion_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.DeleteExclusionRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_exclusion), + '__call__') as call: + client.delete_exclusion(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.DeleteExclusionRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_exclusion_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -8081,6 +8828,33 @@ def test_get_cmek_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetCmekSettingsRequest() + +def test_get_cmek_settings_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetCmekSettingsRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_cmek_settings), + '__call__') as call: + client.get_cmek_settings(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetCmekSettingsRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_cmek_settings_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -8270,6 +9044,33 @@ def test_update_cmek_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateCmekSettingsRequest() + +def test_update_cmek_settings_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateCmekSettingsRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_cmek_settings), + '__call__') as call: + client.update_cmek_settings(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateCmekSettingsRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_cmek_settings_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -8461,6 +9262,33 @@ def test_get_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.GetSettingsRequest() + +def test_get_settings_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.GetSettingsRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_settings), + '__call__') as call: + client.get_settings(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.GetSettingsRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_settings_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -8737,6 +9565,33 @@ def test_update_settings_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.UpdateSettingsRequest() + +def test_update_settings_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.UpdateSettingsRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_settings), + '__call__') as call: + client.update_settings(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.UpdateSettingsRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_update_settings_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -9012,6 +9867,37 @@ def test_copy_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_config.CopyLogEntriesRequest() + +def test_copy_log_entries_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = ConfigServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_config.CopyLogEntriesRequest( + name='name_value', + filter='filter_value', + destination='destination_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.copy_log_entries), + '__call__') as call: + client.copy_log_entries(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_config.CopyLogEntriesRequest( + name='name_value', + filter='filter_value', + destination='destination_value', + ) + @pytest.mark.asyncio async def test_copy_log_entries_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 2c56407ad1..9546e43a2e 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 @@ -796,6 +796,33 @@ def test_delete_log_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.DeleteLogRequest() + +def test_delete_log_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = LoggingServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging.DeleteLogRequest( + log_name='log_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_log), + '__call__') as call: + client.delete_log(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.DeleteLogRequest( + log_name='log_name_value', + ) + @pytest.mark.asyncio async def test_delete_log_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1045,6 +1072,33 @@ def test_write_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.WriteLogEntriesRequest() + +def test_write_log_entries_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = LoggingServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging.WriteLogEntriesRequest( + log_name='log_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.write_log_entries), + '__call__') as call: + client.write_log_entries(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.WriteLogEntriesRequest( + log_name='log_name_value', + ) + @pytest.mark.asyncio async def test_write_log_entries_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1265,6 +1319,37 @@ def test_list_log_entries_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListLogEntriesRequest() + +def test_list_log_entries_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = LoggingServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging.ListLogEntriesRequest( + filter='filter_value', + order_by='order_by_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_log_entries), + '__call__') as call: + client.list_log_entries(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListLogEntriesRequest( + filter='filter_value', + order_by='order_by_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_log_entries_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1665,6 +1750,33 @@ def test_list_monitored_resource_descriptors_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListMonitoredResourceDescriptorsRequest() + +def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = LoggingServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging.ListMonitoredResourceDescriptorsRequest( + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_monitored_resource_descriptors), + '__call__') as call: + client.list_monitored_resource_descriptors(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListMonitoredResourceDescriptorsRequest( + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_monitored_resource_descriptors_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1965,6 +2077,35 @@ def test_list_logs_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging.ListLogsRequest() + +def test_list_logs_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = LoggingServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging.ListLogsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_logs), + '__call__') as call: + client.list_logs(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging.ListLogsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_logs_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 5367494ddc..aaa1a997cd 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 @@ -797,6 +797,35 @@ def test_list_log_metrics_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.ListLogMetricsRequest() + +def test_list_log_metrics_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = MetricsServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_metrics.ListLogMetricsRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_log_metrics), + '__call__') as call: + client.list_log_metrics(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.ListLogMetricsRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_log_metrics_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1257,6 +1286,33 @@ def test_get_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.GetLogMetricRequest() + +def test_get_log_metric_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = MetricsServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_metrics.GetLogMetricRequest( + metric_name='metric_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_log_metric), + '__call__') as call: + client.get_log_metric(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.GetLogMetricRequest( + metric_name='metric_name_value', + ) + @pytest.mark.asyncio async def test_get_log_metric_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1543,6 +1599,33 @@ def test_create_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.CreateLogMetricRequest() + +def test_create_log_metric_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = MetricsServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_metrics.CreateLogMetricRequest( + parent='parent_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_log_metric), + '__call__') as call: + client.create_log_metric(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.CreateLogMetricRequest( + parent='parent_value', + ) + @pytest.mark.asyncio async def test_create_log_metric_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1839,6 +1922,33 @@ def test_update_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.UpdateLogMetricRequest() + +def test_update_log_metric_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = MetricsServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_metrics.UpdateLogMetricRequest( + metric_name='metric_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_log_metric), + '__call__') as call: + client.update_log_metric(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.UpdateLogMetricRequest( + metric_name='metric_name_value', + ) + @pytest.mark.asyncio async def test_update_log_metric_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2120,6 +2230,33 @@ def test_delete_log_metric_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == logging_metrics.DeleteLogMetricRequest() + +def test_delete_log_metric_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = MetricsServiceV2Client( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = logging_metrics.DeleteLogMetricRequest( + metric_name='metric_name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_log_metric), + '__call__') as call: + client.delete_log_metric(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == logging_metrics.DeleteLogMetricRequest( + metric_name='metric_name_value', + ) + @pytest.mark.asyncio async def test_delete_log_metric_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, 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 57b5388f83..4784683eb7 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 @@ -823,6 +823,35 @@ def test_list_instances_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ListInstancesRequest() + +def test_list_instances_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.ListInstancesRequest( + parent='parent_value', + page_token='page_token_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_instances), + '__call__') as call: + client.list_instances(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ListInstancesRequest( + parent='parent_value', + page_token='page_token_value', + ) + @pytest.mark.asyncio async def test_list_instances_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1326,6 +1355,33 @@ def test_get_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.GetInstanceRequest() + +def test_get_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.GetInstanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_instance), + '__call__') as call: + client.get_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.GetInstanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1660,6 +1716,33 @@ def test_get_instance_auth_string_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.GetInstanceAuthStringRequest() + +def test_get_instance_auth_string_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.GetInstanceAuthStringRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_instance_auth_string), + '__call__') as call: + client.get_instance_auth_string(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.GetInstanceAuthStringRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_get_instance_auth_string_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -1913,6 +1996,35 @@ def test_create_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.CreateInstanceRequest() + +def test_create_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.CreateInstanceRequest( + parent='parent_value', + instance_id='instance_id_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_instance), + '__call__') as call: + client.create_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.CreateInstanceRequest( + parent='parent_value', + instance_id='instance_id_value', + ) + @pytest.mark.asyncio async def test_create_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2187,6 +2299,31 @@ def test_update_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.UpdateInstanceRequest() + +def test_update_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.UpdateInstanceRequest( + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_instance), + '__call__') as call: + client.update_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.UpdateInstanceRequest( + ) + @pytest.mark.asyncio async def test_update_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2451,6 +2588,35 @@ def test_upgrade_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.UpgradeInstanceRequest() + +def test_upgrade_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.UpgradeInstanceRequest( + name='name_value', + redis_version='redis_version_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.upgrade_instance), + '__call__') as call: + client.upgrade_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.UpgradeInstanceRequest( + name='name_value', + redis_version='redis_version_value', + ) + @pytest.mark.asyncio async def test_upgrade_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2715,6 +2881,33 @@ def test_import_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ImportInstanceRequest() + +def test_import_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.ImportInstanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_instance), + '__call__') as call: + client.import_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ImportInstanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_import_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -2979,6 +3172,33 @@ def test_export_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.ExportInstanceRequest() + +def test_export_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.ExportInstanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.export_instance), + '__call__') as call: + client.export_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.ExportInstanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_export_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3243,6 +3463,33 @@ def test_failover_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.FailoverInstanceRequest() + +def test_failover_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.FailoverInstanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.failover_instance), + '__call__') as call: + client.failover_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.FailoverInstanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_failover_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3507,6 +3754,33 @@ def test_delete_instance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.DeleteInstanceRequest() + +def test_delete_instance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.DeleteInstanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_instance), + '__call__') as call: + client.delete_instance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.DeleteInstanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_delete_instance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, @@ -3761,6 +4035,33 @@ def test_reschedule_maintenance_empty_call(): _, args, _ = call.mock_calls[0] assert args[0] == cloud_redis.RescheduleMaintenanceRequest() + +def test_reschedule_maintenance_non_empty_request_with_auto_populated_field(): + # This test is a coverage failsafe to make sure that uuid4 fields are + # automatically populated, according to AIP-4235, with non-empty requests. + client = CloudRedisClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Populate all string fields in the request which are not uuid4 + # since we want to check that uuid4 are populated automatically + # if they meet the requirements of AIP 4235. + request = cloud_redis.RescheduleMaintenanceRequest( + name='name_value', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.reschedule_maintenance), + '__call__') as call: + client.reschedule_maintenance(request=request) + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cloud_redis.RescheduleMaintenanceRequest( + name='name_value', + ) + @pytest.mark.asyncio async def test_reschedule_maintenance_empty_call_async(): # This test is a coverage failsafe to make sure that totally empty calls, From e14599cd35f27e361bf75080775540f4618fa1a8 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 10:40:14 +0000 Subject: [PATCH 08/14] update goldens --- .../unit/gapic/asset_v1/test_asset_service.py | 138 ++++++------- .../credentials_v1/test_iam_credentials.py | 24 +-- .../unit/gapic/eventarc_v1/test_eventarc.py | 108 +++++----- .../logging_v2/test_config_service_v2.py | 192 +++++++++--------- .../logging_v2/test_logging_service_v2.py | 30 +-- .../logging_v2/test_metrics_service_v2.py | 30 +-- .../unit/gapic/redis_v1/test_cloud_redis.py | 66 +++--- 7 files changed, 294 insertions(+), 294 deletions(-) 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 30061e753d..7b8cd35c59 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 @@ -819,15 +819,15 @@ def test_export_assets_empty_call(): def test_export_assets_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.ExportAssetsRequest( parent='parent_value', @@ -1019,15 +1019,15 @@ def test_list_assets_empty_call(): def test_list_assets_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.ListAssetsRequest( parent='parent_value', @@ -1494,15 +1494,15 @@ def test_batch_get_assets_history_empty_call(): def test_batch_get_assets_history_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.BatchGetAssetsHistoryRequest( parent='parent_value', @@ -1700,15 +1700,15 @@ def test_create_feed_empty_call(): def test_create_feed_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.CreateFeedRequest( parent='parent_value', @@ -2005,15 +2005,15 @@ def test_get_feed_empty_call(): def test_get_feed_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.GetFeedRequest( name='name_value', @@ -2298,15 +2298,15 @@ def test_list_feeds_empty_call(): def test_list_feeds_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.ListFeedsRequest( parent='parent_value', @@ -2586,15 +2586,15 @@ def test_update_feed_empty_call(): def test_update_feed_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.UpdateFeedRequest( ) @@ -2876,15 +2876,15 @@ def test_delete_feed_empty_call(): def test_delete_feed_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.DeleteFeedRequest( name='name_value', @@ -3154,15 +3154,15 @@ def test_search_all_resources_empty_call(): def test_search_all_resources_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.SearchAllResourcesRequest( scope='scope_value', @@ -3655,15 +3655,15 @@ def test_search_all_iam_policies_empty_call(): def test_search_all_iam_policies_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.SearchAllIamPoliciesRequest( scope='scope_value', @@ -4146,15 +4146,15 @@ def test_analyze_iam_policy_empty_call(): def test_analyze_iam_policy_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeIamPolicyRequest( saved_analysis_query='saved_analysis_query_value', @@ -4344,15 +4344,15 @@ def test_analyze_iam_policy_longrunning_empty_call(): def test_analyze_iam_policy_longrunning_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeIamPolicyLongrunningRequest( saved_analysis_query='saved_analysis_query_value', @@ -4542,15 +4542,15 @@ def test_analyze_move_empty_call(): def test_analyze_move_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeMoveRequest( resource='resource_value', @@ -4744,15 +4744,15 @@ def test_query_assets_empty_call(): def test_query_assets_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.QueryAssetsRequest( parent='parent_value', @@ -4960,15 +4960,15 @@ def test_create_saved_query_empty_call(): def test_create_saved_query_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.CreateSavedQueryRequest( parent='parent_value', @@ -5280,15 +5280,15 @@ def test_get_saved_query_empty_call(): def test_get_saved_query_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.GetSavedQueryRequest( name='name_value', @@ -5572,15 +5572,15 @@ def test_list_saved_queries_empty_call(): def test_list_saved_queries_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.ListSavedQueriesRequest( parent='parent_value', @@ -6057,15 +6057,15 @@ def test_update_saved_query_empty_call(): def test_update_saved_query_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.UpdateSavedQueryRequest( ) @@ -6354,15 +6354,15 @@ def test_delete_saved_query_empty_call(): def test_delete_saved_query_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.DeleteSavedQueryRequest( name='name_value', @@ -6630,15 +6630,15 @@ def test_batch_get_effective_iam_policies_empty_call(): def test_batch_get_effective_iam_policies_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.BatchGetEffectiveIamPoliciesRequest( scope='scope_value', @@ -6828,15 +6828,15 @@ def test_analyze_org_policies_empty_call(): def test_analyze_org_policies_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeOrgPoliciesRequest( scope='scope_value', @@ -7329,15 +7329,15 @@ def test_analyze_org_policy_governed_containers_empty_call(): def test_analyze_org_policy_governed_containers_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeOrgPolicyGovernedContainersRequest( scope='scope_value', @@ -7830,15 +7830,15 @@ def test_analyze_org_policy_governed_assets_empty_call(): def test_analyze_org_policy_governed_assets_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = AssetServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = asset_service.AnalyzeOrgPolicyGovernedAssetsRequest( scope='scope_value', 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 13d86b4c6b..8aeffb77cd 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 @@ -812,15 +812,15 @@ def test_generate_access_token_empty_call(): def test_generate_access_token_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = common.GenerateAccessTokenRequest( name='name_value', @@ -1121,15 +1121,15 @@ def test_generate_id_token_empty_call(): def test_generate_id_token_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = common.GenerateIdTokenRequest( name='name_value', @@ -1438,15 +1438,15 @@ def test_sign_blob_empty_call(): def test_sign_blob_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = common.SignBlobRequest( name='name_value', @@ -1746,15 +1746,15 @@ def test_sign_jwt_empty_call(): def test_sign_jwt_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = IAMCredentialsClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = common.SignJwtRequest( name='name_value', 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 2729c0e94d..cfbaa10425 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 @@ -840,15 +840,15 @@ def test_get_trigger_empty_call(): def test_get_trigger_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.GetTriggerRequest( name='name_value', @@ -1137,15 +1137,15 @@ def test_list_triggers_empty_call(): def test_list_triggers_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.ListTriggersRequest( parent='parent_value', @@ -1618,15 +1618,15 @@ def test_create_trigger_empty_call(): def test_create_trigger_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.CreateTriggerRequest( parent='parent_value', @@ -1921,15 +1921,15 @@ def test_update_trigger_empty_call(): def test_update_trigger_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.UpdateTriggerRequest( ) @@ -2220,15 +2220,15 @@ def test_delete_trigger_empty_call(): def test_delete_trigger_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.DeleteTriggerRequest( name='name_value', @@ -2527,15 +2527,15 @@ def test_get_channel_empty_call(): def test_get_channel_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.GetChannelRequest( name='name_value', @@ -2827,15 +2827,15 @@ def test_list_channels_empty_call(): def test_list_channels_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.ListChannelsRequest( parent='parent_value', @@ -3306,15 +3306,15 @@ def test_create_channel_empty_call(): def test_create_channel_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.CreateChannelRequest( parent='parent_value', @@ -3609,15 +3609,15 @@ def test_update_channel_empty_call(): def test_update_channel_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.UpdateChannelRequest( ) @@ -3898,15 +3898,15 @@ def test_delete_channel_empty_call(): def test_delete_channel_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.DeleteChannelRequest( name='name_value', @@ -4184,15 +4184,15 @@ def test_get_provider_empty_call(): def test_get_provider_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.GetProviderRequest( name='name_value', @@ -4472,15 +4472,15 @@ def test_list_providers_empty_call(): def test_list_providers_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.ListProvidersRequest( parent='parent_value', @@ -4962,15 +4962,15 @@ def test_get_channel_connection_empty_call(): def test_get_channel_connection_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.GetChannelConnectionRequest( name='name_value', @@ -5256,15 +5256,15 @@ def test_list_channel_connections_empty_call(): def test_list_channel_connections_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.ListChannelConnectionsRequest( parent='parent_value', @@ -5733,15 +5733,15 @@ def test_create_channel_connection_empty_call(): def test_create_channel_connection_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.CreateChannelConnectionRequest( parent='parent_value', @@ -6036,15 +6036,15 @@ def test_delete_channel_connection_empty_call(): def test_delete_channel_connection_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.DeleteChannelConnectionRequest( name='name_value', @@ -6322,15 +6322,15 @@ def test_get_google_channel_config_empty_call(): def test_get_google_channel_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.GetGoogleChannelConfigRequest( name='name_value', @@ -6610,15 +6610,15 @@ def test_update_google_channel_config_empty_call(): def test_update_google_channel_config_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = EventarcClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = eventarc.UpdateGoogleChannelConfigRequest( ) 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 19287ef3a4..16ea15f33a 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 @@ -799,15 +799,15 @@ def test_list_buckets_empty_call(): def test_list_buckets_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.ListBucketsRequest( parent='parent_value', @@ -1288,15 +1288,15 @@ def test_get_bucket_empty_call(): def test_get_bucket_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetBucketRequest( name='name_value', @@ -1504,15 +1504,15 @@ def test_create_bucket_async_empty_call(): def test_create_bucket_async_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateBucketRequest( parent='parent_value', @@ -1703,15 +1703,15 @@ def test_update_bucket_async_empty_call(): def test_update_bucket_async_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateBucketRequest( name='name_value', @@ -1915,15 +1915,15 @@ def test_create_bucket_empty_call(): def test_create_bucket_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateBucketRequest( parent='parent_value', @@ -2148,15 +2148,15 @@ def test_update_bucket_empty_call(): def test_update_bucket_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateBucketRequest( name='name_value', @@ -2364,15 +2364,15 @@ def test_delete_bucket_empty_call(): def test_delete_bucket_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.DeleteBucketRequest( name='name_value', @@ -2557,15 +2557,15 @@ def test_undelete_bucket_empty_call(): def test_undelete_bucket_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UndeleteBucketRequest( name='name_value', @@ -2753,15 +2753,15 @@ def test_list_views_empty_call(): def test_list_views_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.ListViewsRequest( parent='parent_value', @@ -3234,15 +3234,15 @@ def test_get_view_empty_call(): def test_get_view_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetViewRequest( name='name_value', @@ -3445,15 +3445,15 @@ def test_create_view_empty_call(): def test_create_view_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateViewRequest( parent='parent_value', @@ -3658,15 +3658,15 @@ def test_update_view_empty_call(): def test_update_view_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateViewRequest( name='name_value', @@ -3862,15 +3862,15 @@ def test_delete_view_empty_call(): def test_delete_view_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.DeleteViewRequest( name='name_value', @@ -4058,15 +4058,15 @@ def test_list_sinks_empty_call(): def test_list_sinks_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.ListSinksRequest( parent='parent_value', @@ -4549,15 +4549,15 @@ def test_get_sink_empty_call(): def test_get_sink_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetSinkRequest( sink_name='sink_name_value', @@ -4867,15 +4867,15 @@ def test_create_sink_empty_call(): def test_create_sink_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateSinkRequest( parent='parent_value', @@ -5195,15 +5195,15 @@ def test_update_sink_empty_call(): def test_update_sink_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateSinkRequest( sink_name='sink_name_value', @@ -5516,15 +5516,15 @@ def test_delete_sink_empty_call(): def test_delete_sink_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.DeleteSinkRequest( sink_name='sink_name_value', @@ -5791,15 +5791,15 @@ def test_create_link_empty_call(): def test_create_link_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateLinkRequest( parent='parent_value', @@ -6094,15 +6094,15 @@ def test_delete_link_empty_call(): def test_delete_link_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.DeleteLinkRequest( name='name_value', @@ -6378,15 +6378,15 @@ def test_list_links_empty_call(): def test_list_links_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.ListLinksRequest( parent='parent_value', @@ -6859,15 +6859,15 @@ def test_get_link_empty_call(): def test_get_link_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetLinkRequest( name='name_value', @@ -7148,15 +7148,15 @@ def test_list_exclusions_empty_call(): def test_list_exclusions_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.ListExclusionsRequest( parent='parent_value', @@ -7631,15 +7631,15 @@ def test_get_exclusion_empty_call(): def test_get_exclusion_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetExclusionRequest( name='name_value', @@ -7929,15 +7929,15 @@ def test_create_exclusion_empty_call(): def test_create_exclusion_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CreateExclusionRequest( parent='parent_value', @@ -8237,15 +8237,15 @@ def test_update_exclusion_empty_call(): def test_update_exclusion_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateExclusionRequest( name='name_value', @@ -8546,15 +8546,15 @@ def test_delete_exclusion_empty_call(): def test_delete_exclusion_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.DeleteExclusionRequest( name='name_value', @@ -8830,15 +8830,15 @@ def test_get_cmek_settings_empty_call(): def test_get_cmek_settings_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetCmekSettingsRequest( name='name_value', @@ -9046,15 +9046,15 @@ def test_update_cmek_settings_empty_call(): def test_update_cmek_settings_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateCmekSettingsRequest( name='name_value', @@ -9264,15 +9264,15 @@ def test_get_settings_empty_call(): def test_get_settings_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.GetSettingsRequest( name='name_value', @@ -9567,15 +9567,15 @@ def test_update_settings_empty_call(): def test_update_settings_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.UpdateSettingsRequest( name='name_value', @@ -9869,15 +9869,15 @@ def test_copy_log_entries_empty_call(): def test_copy_log_entries_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = ConfigServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_config.CopyLogEntriesRequest( name='name_value', 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 9546e43a2e..1f36c98d28 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 @@ -798,15 +798,15 @@ def test_delete_log_empty_call(): def test_delete_log_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging.DeleteLogRequest( log_name='log_name_value', @@ -1074,15 +1074,15 @@ def test_write_log_entries_empty_call(): def test_write_log_entries_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging.WriteLogEntriesRequest( log_name='log_name_value', @@ -1321,15 +1321,15 @@ def test_list_log_entries_empty_call(): def test_list_log_entries_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging.ListLogEntriesRequest( filter='filter_value', @@ -1752,15 +1752,15 @@ def test_list_monitored_resource_descriptors_empty_call(): def test_list_monitored_resource_descriptors_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging.ListMonitoredResourceDescriptorsRequest( page_token='page_token_value', @@ -2079,15 +2079,15 @@ def test_list_logs_empty_call(): def test_list_logs_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = LoggingServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging.ListLogsRequest( parent='parent_value', 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 aaa1a997cd..80884275a7 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 @@ -799,15 +799,15 @@ def test_list_log_metrics_empty_call(): def test_list_log_metrics_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_metrics.ListLogMetricsRequest( parent='parent_value', @@ -1288,15 +1288,15 @@ def test_get_log_metric_empty_call(): def test_get_log_metric_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_metrics.GetLogMetricRequest( metric_name='metric_name_value', @@ -1601,15 +1601,15 @@ def test_create_log_metric_empty_call(): def test_create_log_metric_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_metrics.CreateLogMetricRequest( parent='parent_value', @@ -1924,15 +1924,15 @@ def test_update_log_metric_empty_call(): def test_update_log_metric_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_metrics.UpdateLogMetricRequest( metric_name='metric_name_value', @@ -2232,15 +2232,15 @@ def test_delete_log_metric_empty_call(): def test_delete_log_metric_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = MetricsServiceV2Client( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = logging_metrics.DeleteLogMetricRequest( metric_name='metric_name_value', 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 4784683eb7..d27f7d237f 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 @@ -825,15 +825,15 @@ def test_list_instances_empty_call(): def test_list_instances_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.ListInstancesRequest( parent='parent_value', @@ -1357,15 +1357,15 @@ def test_get_instance_empty_call(): def test_get_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.GetInstanceRequest( name='name_value', @@ -1718,15 +1718,15 @@ def test_get_instance_auth_string_empty_call(): def test_get_instance_auth_string_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.GetInstanceAuthStringRequest( name='name_value', @@ -1998,15 +1998,15 @@ def test_create_instance_empty_call(): def test_create_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.CreateInstanceRequest( parent='parent_value', @@ -2301,15 +2301,15 @@ def test_update_instance_empty_call(): def test_update_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.UpdateInstanceRequest( ) @@ -2590,15 +2590,15 @@ def test_upgrade_instance_empty_call(): def test_upgrade_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.UpgradeInstanceRequest( name='name_value', @@ -2883,15 +2883,15 @@ def test_import_instance_empty_call(): def test_import_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.ImportInstanceRequest( name='name_value', @@ -3174,15 +3174,15 @@ def test_export_instance_empty_call(): def test_export_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.ExportInstanceRequest( name='name_value', @@ -3465,15 +3465,15 @@ def test_failover_instance_empty_call(): def test_failover_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.FailoverInstanceRequest( name='name_value', @@ -3756,15 +3756,15 @@ def test_delete_instance_empty_call(): def test_delete_instance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.DeleteInstanceRequest( name='name_value', @@ -4037,15 +4037,15 @@ def test_reschedule_maintenance_empty_call(): def test_reschedule_maintenance_non_empty_request_with_auto_populated_field(): - # This test is a coverage failsafe to make sure that uuid4 fields are + # This test is a coverage failsafe to make sure that UUID4 fields are # automatically populated, according to AIP-4235, with non-empty requests. client = CloudRedisClient( credentials=ga_credentials.AnonymousCredentials(), transport='grpc', ) - # Populate all string fields in the request which are not uuid4 - # since we want to check that uuid4 are populated automatically + # Populate all string fields in the request which are not UUID4 + # since we want to check that UUID4 are populated automatically # if they meet the requirements of AIP 4235. request = cloud_redis.RescheduleMaintenanceRequest( name='name_value', From 11bb6b4080e7900c24c7269fb910eb598236c398 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 10:49:59 +0000 Subject: [PATCH 09/14] update sample value for uuid4 field --- .../%name_%version/%sub/test_%service.py.j2 | 8 +++++--- .../gapic/%name_%version/%sub/test_macros.j2 | 16 ++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 7601ac9037..1afd2a1b74 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -516,6 +516,7 @@ def test_{{ service.client_name|snake_case }}_create_channel_credentials_file(cl dict, ]) def test_{{ method_name }}(request_type, transport: str = 'grpc'): + {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.client_name }}( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -530,9 +531,9 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} if isinstance(request, dict): - request['{{ auto_populated_field }}'] = "str_value" + request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" else: - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -587,7 +588,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -631,6 +632,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% endif %}{# end oneof/optional #} {% endfor %} {% endif %} + {% endwith %}{# auto_populated_field_sample_value #} {% if not method.client_streaming %} 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 e78d4acf85..9ba4532df5 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 @@ -5,6 +5,7 @@ dict, ]) def test_{{ method_name }}(request_type, transport: str = 'grpc'): + {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.client_name }}( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -18,9 +19,9 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} if isinstance(request, dict): - request['{{ auto_populated_field }}'] = "str_value" + request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" else: - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -73,7 +74,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -117,6 +118,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): {% endif %}{# end oneof/optional #} {% endfor %} {% endif %} + {% endwith %}{# auto_populated_field_sample_value #} {% if not method.client_streaming %} @@ -252,6 +254,7 @@ async def test_{{ method_name }}_empty_call_async(): @pytest.mark.asyncio async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_type={{ method.input.ident }}): + {% with auto_populated_field_sample_value = "explicit value for autopopulate-able field" %} client = {{ service.async_client_name }}( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -265,9 +268,9 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} if isinstance(request, dict): - request['{{ auto_populated_field }}'] = "str_value" + request['{{ auto_populated_field }}'] = "{{ auto_populated_field_sample_value }}" else: - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -323,7 +326,7 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} - request.{{ auto_populated_field }} = "str_value" + request.{{ auto_populated_field }} = "{{ auto_populated_field_sample_value }}" {% endfor %} {% endif %}{# if method_settings is not none #} {% endwith %}{# method_settings #} @@ -363,6 +366,7 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ {% endif %}{# oneof/optional #} {% endfor %} {% endif %} + {% endwith %}{# auto_populated_field_sample_value #} @pytest.mark.asyncio From 7fa920b03341ed329642546e47a49415d4d1081c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 06:57:51 -0400 Subject: [PATCH 10/14] Update comment for macro Co-authored-by: Victor Chudnovsky --- .../%name_%version/%sub/services/%service/_client_macros.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 index 5d751f1c80..8d08f0ed42 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/_client_macros.j2 @@ -276,6 +276,7 @@ - The field supports explicit presence and has not been set by the user. - The field doesn't support explicit presence, and its value is the empty string (i.e. the default value). + When using this macro, ensure the calling template generates a line `import uuid` #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} From 7d9b35c998edde74c4638d17572dd1448e87141e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 06:59:10 -0400 Subject: [PATCH 11/14] formatting Co-authored-by: Victor Chudnovsky --- .../tests/unit/gapic/%name_%version/%sub/test_macros.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9ba4532df5..d9a91f4caa 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 @@ -224,7 +224,7 @@ async def test_{{ method_name }}_empty_call_async(): call.return_value = mock.Mock(aio.StreamStreamCall, autospec=True) call.return_value.read = mock.AsyncMock(side_effect=[{{ method.output.ident }}()]) {% else %} - call.return_value ={{ '' }} + call.return_value = {{ '' }} {%- if not method.client_streaming and not method.server_streaming -%} grpc_helpers_async.FakeUnaryUnaryCall {%- else -%} From bbb95f085cf3b32ed33b8a320b1f7a68b50a1509 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 11:00:34 +0000 Subject: [PATCH 12/14] typo --- .../tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 | 2 +- .../tests/unit/gapic/%name_%version/%sub/test_macros.j2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 1afd2a1b74..08e2d21a38 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -526,7 +526,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # and we are mocking out the actual API, so just send an empty request. request = request_type() - {# Set UUID4 fields so that they are not automatically popoulated. #} + {# Set UUID4 fields so that they are not automatically populated. #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} 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 d9a91f4caa..4b4f705a75 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 @@ -14,7 +14,7 @@ def test_{{ method_name }}(request_type, transport: str = 'grpc'): # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() - {# Set UUID4 fields so that they are not automatically popoulated. #} + {# Set UUID4 fields so that they are not automatically populated. #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} @@ -263,7 +263,7 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() - {# Set UUID4 fields so that they are not automatically popoulated. #} + {# Set UUID4 fields so that they are not automatically populated. #} {% with method_settings = api.all_method_settings.get(method.meta.address.proto) %} {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} From 04f92bb09562aeb27004dd1997c3c192e462e1b9 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 21 Mar 2024 11:03:40 +0000 Subject: [PATCH 13/14] update goldens --- .../unit/gapic/asset_v1/test_asset_service.py | 38 ++++++++-------- .../credentials_v1/test_iam_credentials.py | 8 ++-- .../unit/gapic/eventarc_v1/test_eventarc.py | 20 ++++----- .../logging_v2/test_config_service_v2.py | 44 +++++++++---------- .../logging_v2/test_logging_service_v2.py | 8 ++-- .../logging_v2/test_metrics_service_v2.py | 8 ++-- .../unit/gapic/redis_v1/test_cloud_redis.py | 6 +-- 7 files changed, 66 insertions(+), 66 deletions(-) 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 7b8cd35c59..ec79f660bc 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 @@ -1060,7 +1060,7 @@ async def test_list_assets_empty_call_async(): type(client.transport.list_assets), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListAssetsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListAssetsResponse( next_page_token='next_page_token_value', )) response = await client.list_assets() @@ -1533,7 +1533,7 @@ async def test_batch_get_assets_history_empty_call_async(): type(client.transport.batch_get_assets_history), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetAssetsHistoryResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetAssetsHistoryResponse( )) response = await client.batch_get_assets_history() call.assert_called() @@ -1741,7 +1741,7 @@ async def test_create_feed_empty_call_async(): type(client.transport.create_feed), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( name='name_value', asset_names=['asset_names_value'], asset_types=['asset_types_value'], @@ -2044,7 +2044,7 @@ async def test_get_feed_empty_call_async(): type(client.transport.get_feed), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( name='name_value', asset_names=['asset_names_value'], asset_types=['asset_types_value'], @@ -2337,7 +2337,7 @@ async def test_list_feeds_empty_call_async(): type(client.transport.list_feeds), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListFeedsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListFeedsResponse( )) response = await client.list_feeds() call.assert_called() @@ -2623,7 +2623,7 @@ async def test_update_feed_empty_call_async(): type(client.transport.update_feed), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.Feed( name='name_value', asset_names=['asset_names_value'], asset_types=['asset_types_value'], @@ -3199,7 +3199,7 @@ async def test_search_all_resources_empty_call_async(): type(client.transport.search_all_resources), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllResourcesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllResourcesResponse( next_page_token='next_page_token_value', )) response = await client.search_all_resources() @@ -3700,7 +3700,7 @@ async def test_search_all_iam_policies_empty_call_async(): type(client.transport.search_all_iam_policies), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllIamPoliciesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SearchAllIamPoliciesResponse( next_page_token='next_page_token_value', )) response = await client.search_all_iam_policies() @@ -4185,7 +4185,7 @@ async def test_analyze_iam_policy_empty_call_async(): type(client.transport.analyze_iam_policy), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeIamPolicyResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeIamPolicyResponse( fully_explored=True, )) response = await client.analyze_iam_policy() @@ -4583,7 +4583,7 @@ async def test_analyze_move_empty_call_async(): type(client.transport.analyze_move), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeMoveResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeMoveResponse( )) response = await client.analyze_move() call.assert_called() @@ -4789,7 +4789,7 @@ async def test_query_assets_empty_call_async(): type(client.transport.query_assets), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.QueryAssetsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.QueryAssetsResponse( job_reference='job_reference_value', done=True, )) @@ -5001,7 +5001,7 @@ async def test_create_saved_query_empty_call_async(): type(client.transport.create_saved_query), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( name='name_value', description='description_value', creator='creator_value', @@ -5319,7 +5319,7 @@ async def test_get_saved_query_empty_call_async(): type(client.transport.get_saved_query), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( name='name_value', description='description_value', creator='creator_value', @@ -5615,7 +5615,7 @@ async def test_list_saved_queries_empty_call_async(): type(client.transport.list_saved_queries), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListSavedQueriesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.ListSavedQueriesResponse( next_page_token='next_page_token_value', )) response = await client.list_saved_queries() @@ -6094,7 +6094,7 @@ async def test_update_saved_query_empty_call_async(): type(client.transport.update_saved_query), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.SavedQuery( name='name_value', description='description_value', creator='creator_value', @@ -6669,7 +6669,7 @@ async def test_batch_get_effective_iam_policies_empty_call_async(): type(client.transport.batch_get_effective_iam_policies), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetEffectiveIamPoliciesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.BatchGetEffectiveIamPoliciesResponse( )) response = await client.batch_get_effective_iam_policies() call.assert_called() @@ -6873,7 +6873,7 @@ async def test_analyze_org_policies_empty_call_async(): type(client.transport.analyze_org_policies), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPoliciesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPoliciesResponse( next_page_token='next_page_token_value', )) response = await client.analyze_org_policies() @@ -7374,7 +7374,7 @@ async def test_analyze_org_policy_governed_containers_empty_call_async(): type(client.transport.analyze_org_policy_governed_containers), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedContainersResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedContainersResponse( next_page_token='next_page_token_value', )) response = await client.analyze_org_policy_governed_containers() @@ -7875,7 +7875,7 @@ async def test_analyze_org_policy_governed_assets_empty_call_async(): type(client.transport.analyze_org_policy_governed_assets), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedAssetsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(asset_service.AnalyzeOrgPolicyGovernedAssetsResponse( next_page_token='next_page_token_value', )) response = await client.analyze_org_policy_governed_assets() 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 8aeffb77cd..f12e4689fd 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 @@ -851,7 +851,7 @@ async def test_generate_access_token_empty_call_async(): type(client.transport.generate_access_token), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateAccessTokenResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateAccessTokenResponse( access_token='access_token_value', )) response = await client.generate_access_token() @@ -1162,7 +1162,7 @@ async def test_generate_id_token_empty_call_async(): type(client.transport.generate_id_token), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateIdTokenResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(common.GenerateIdTokenResponse( token='token_value', )) response = await client.generate_id_token() @@ -1477,7 +1477,7 @@ async def test_sign_blob_empty_call_async(): type(client.transport.sign_blob), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.SignBlobResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(common.SignBlobResponse( key_id='key_id_value', signed_blob=b'signed_blob_blob', )) @@ -1787,7 +1787,7 @@ async def test_sign_jwt_empty_call_async(): type(client.transport.sign_jwt), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(common.SignJwtResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(common.SignJwtResponse( key_id='key_id_value', signed_jwt='signed_jwt_value', )) 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 cfbaa10425..5729663c9c 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 @@ -879,7 +879,7 @@ async def test_get_trigger_empty_call_async(): type(client.transport.get_trigger), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(trigger.Trigger( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(trigger.Trigger( name='name_value', uid='uid_value', service_account='service_account_value', @@ -1182,7 +1182,7 @@ async def test_list_triggers_empty_call_async(): type(client.transport.list_triggers), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListTriggersResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListTriggersResponse( next_page_token='next_page_token_value', unreachable=['unreachable_value'], )) @@ -2566,7 +2566,7 @@ async def test_get_channel_empty_call_async(): type(client.transport.get_channel), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel.Channel( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel.Channel( name='name_value', uid='uid_value', provider='provider_value', @@ -2870,7 +2870,7 @@ async def test_list_channels_empty_call_async(): type(client.transport.list_channels), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelsResponse( next_page_token='next_page_token_value', unreachable=['unreachable_value'], )) @@ -4223,7 +4223,7 @@ async def test_get_provider_empty_call_async(): type(client.transport.get_provider), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(discovery.Provider( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(discovery.Provider( name='name_value', display_name='display_name_value', )) @@ -4517,7 +4517,7 @@ async def test_list_providers_empty_call_async(): type(client.transport.list_providers), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListProvidersResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListProvidersResponse( next_page_token='next_page_token_value', unreachable=['unreachable_value'], )) @@ -5001,7 +5001,7 @@ async def test_get_channel_connection_empty_call_async(): type(client.transport.get_channel_connection), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(channel_connection.ChannelConnection( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(channel_connection.ChannelConnection( name='name_value', uid='uid_value', channel='channel_value', @@ -5297,7 +5297,7 @@ async def test_list_channel_connections_empty_call_async(): type(client.transport.list_channel_connections), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelConnectionsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(eventarc.ListChannelConnectionsResponse( next_page_token='next_page_token_value', unreachable=['unreachable_value'], )) @@ -6361,7 +6361,7 @@ async def test_get_google_channel_config_empty_call_async(): type(client.transport.get_google_channel_config), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(google_channel_config.GoogleChannelConfig( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(google_channel_config.GoogleChannelConfig( name='name_value', crypto_key_name='crypto_key_name_value', )) @@ -6647,7 +6647,7 @@ async def test_update_google_channel_config_empty_call_async(): type(client.transport.update_google_channel_config), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(gce_google_channel_config.GoogleChannelConfig( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gce_google_channel_config.GoogleChannelConfig( name='name_value', crypto_key_name='crypto_key_name_value', )) 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 16ea15f33a..e70efd4e43 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 @@ -840,7 +840,7 @@ async def test_list_buckets_empty_call_async(): type(client.transport.list_buckets), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListBucketsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListBucketsResponse( next_page_token='next_page_token_value', )) response = await client.list_buckets() @@ -1327,7 +1327,7 @@ async def test_get_bucket_empty_call_async(): type(client.transport.get_bucket), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( name='name_value', description='description_value', retention_days=1512, @@ -1956,7 +1956,7 @@ async def test_create_bucket_empty_call_async(): type(client.transport.create_bucket), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( name='name_value', description='description_value', retention_days=1512, @@ -2187,7 +2187,7 @@ async def test_update_bucket_empty_call_async(): type(client.transport.update_bucket), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogBucket( name='name_value', description='description_value', retention_days=1512, @@ -2794,7 +2794,7 @@ async def test_list_views_empty_call_async(): type(client.transport.list_views), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListViewsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListViewsResponse( next_page_token='next_page_token_value', )) response = await client.list_views() @@ -3273,7 +3273,7 @@ async def test_get_view_empty_call_async(): type(client.transport.get_view), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( name='name_value', description='description_value', filter='filter_value', @@ -3486,7 +3486,7 @@ async def test_create_view_empty_call_async(): type(client.transport.create_view), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( name='name_value', description='description_value', filter='filter_value', @@ -3697,7 +3697,7 @@ async def test_update_view_empty_call_async(): type(client.transport.update_view), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogView( name='name_value', description='description_value', filter='filter_value', @@ -4099,7 +4099,7 @@ async def test_list_sinks_empty_call_async(): type(client.transport.list_sinks), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListSinksResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListSinksResponse( next_page_token='next_page_token_value', )) response = await client.list_sinks() @@ -4588,7 +4588,7 @@ async def test_get_sink_empty_call_async(): type(client.transport.get_sink), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( name='name_value', destination='destination_value', filter='filter_value', @@ -4906,7 +4906,7 @@ async def test_create_sink_empty_call_async(): type(client.transport.create_sink), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( name='name_value', destination='destination_value', filter='filter_value', @@ -5234,7 +5234,7 @@ async def test_update_sink_empty_call_async(): type(client.transport.update_sink), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogSink( name='name_value', destination='destination_value', filter='filter_value', @@ -6419,7 +6419,7 @@ async def test_list_links_empty_call_async(): type(client.transport.list_links), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListLinksResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListLinksResponse( next_page_token='next_page_token_value', )) response = await client.list_links() @@ -6898,7 +6898,7 @@ async def test_get_link_empty_call_async(): type(client.transport.get_link), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Link( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Link( name='name_value', description='description_value', lifecycle_state=logging_config.LifecycleState.ACTIVE, @@ -7189,7 +7189,7 @@ async def test_list_exclusions_empty_call_async(): type(client.transport.list_exclusions), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListExclusionsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.ListExclusionsResponse( next_page_token='next_page_token_value', )) response = await client.list_exclusions() @@ -7670,7 +7670,7 @@ async def test_get_exclusion_empty_call_async(): type(client.transport.get_exclusion), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( name='name_value', description='description_value', filter='filter_value', @@ -7968,7 +7968,7 @@ async def test_create_exclusion_empty_call_async(): type(client.transport.create_exclusion), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( name='name_value', description='description_value', filter='filter_value', @@ -8276,7 +8276,7 @@ async def test_update_exclusion_empty_call_async(): type(client.transport.update_exclusion), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.LogExclusion( name='name_value', description='description_value', filter='filter_value', @@ -8869,7 +8869,7 @@ async def test_get_cmek_settings_empty_call_async(): type(client.transport.get_cmek_settings), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( name='name_value', kms_key_name='kms_key_name_value', kms_key_version_name='kms_key_version_name_value', @@ -9085,7 +9085,7 @@ async def test_update_cmek_settings_empty_call_async(): type(client.transport.update_cmek_settings), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.CmekSettings( name='name_value', kms_key_name='kms_key_name_value', kms_key_version_name='kms_key_version_name_value', @@ -9303,7 +9303,7 @@ async def test_get_settings_empty_call_async(): type(client.transport.get_settings), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( name='name_value', kms_key_name='kms_key_name_value', kms_service_account_id='kms_service_account_id_value', @@ -9606,7 +9606,7 @@ async def test_update_settings_empty_call_async(): type(client.transport.update_settings), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_config.Settings( name='name_value', kms_key_name='kms_key_name_value', kms_service_account_id='kms_service_account_id_value', 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 1f36c98d28..b6c611d634 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 @@ -1113,7 +1113,7 @@ async def test_write_log_entries_empty_call_async(): type(client.transport.write_log_entries), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.WriteLogEntriesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging.WriteLogEntriesResponse( )) response = await client.write_log_entries() call.assert_called() @@ -1364,7 +1364,7 @@ async def test_list_log_entries_empty_call_async(): type(client.transport.list_log_entries), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogEntriesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogEntriesResponse( next_page_token='next_page_token_value', )) response = await client.list_log_entries() @@ -1791,7 +1791,7 @@ async def test_list_monitored_resource_descriptors_empty_call_async(): type(client.transport.list_monitored_resource_descriptors), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListMonitoredResourceDescriptorsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging.ListMonitoredResourceDescriptorsResponse( next_page_token='next_page_token_value', )) response = await client.list_monitored_resource_descriptors() @@ -2120,7 +2120,7 @@ async def test_list_logs_empty_call_async(): type(client.transport.list_logs), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging.ListLogsResponse( log_names=['log_names_value'], next_page_token='next_page_token_value', )) 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 80884275a7..d1543607c9 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 @@ -840,7 +840,7 @@ async def test_list_log_metrics_empty_call_async(): type(client.transport.list_log_metrics), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.ListLogMetricsResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.ListLogMetricsResponse( next_page_token='next_page_token_value', )) response = await client.list_log_metrics() @@ -1327,7 +1327,7 @@ async def test_get_log_metric_empty_call_async(): type(client.transport.get_log_metric), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( name='name_value', description='description_value', filter='filter_value', @@ -1640,7 +1640,7 @@ async def test_create_log_metric_empty_call_async(): type(client.transport.create_log_metric), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( name='name_value', description='description_value', filter='filter_value', @@ -1963,7 +1963,7 @@ async def test_update_log_metric_empty_call_async(): type(client.transport.update_log_metric), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(logging_metrics.LogMetric( name='name_value', description='description_value', filter='filter_value', 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 d27f7d237f..edb68db575 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 @@ -866,7 +866,7 @@ async def test_list_instances_empty_call_async(): type(client.transport.list_instances), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.ListInstancesResponse( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.ListInstancesResponse( next_page_token='next_page_token_value', unreachable=['unreachable_value'], )) @@ -1396,7 +1396,7 @@ async def test_get_instance_empty_call_async(): type(client.transport.get_instance), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.Instance( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.Instance( name='name_value', display_name='display_name_value', location_id='location_id_value', @@ -1757,7 +1757,7 @@ async def test_get_instance_auth_string_empty_call_async(): type(client.transport.get_instance_auth_string), '__call__') as call: # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.InstanceAuthString( + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloud_redis.InstanceAuthString( auth_string='auth_string_value', )) response = await client.get_instance_auth_string() From 70f0c64b54bb0551295dbf7f23ced7507202044c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 22 Mar 2024 10:39:21 +0000 Subject: [PATCH 14/14] remove duplication of uuid4 regex --- .../%name_%version/%sub/test_%service.py.j2 | 6 +++-- .../gapic/%name_%version/%sub/test_macros.j2 | 8 ++++--- tests/system/test_unary.py | 22 +++++-------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 index 08e2d21a38..5cc8a9b80f 100644 --- a/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 +++ b/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2 @@ -70,6 +70,7 @@ from google.iam.v1 import policy_pb2 # type: ignore {% endif %} {% endfilter %} +{% with uuid4_re = "[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" %} def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -658,7 +659,7 @@ def test_{{ method_name }}_empty_call(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -696,7 +697,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -2440,4 +2441,5 @@ def test_client_ctx(): pass close.assert_called() +{% endwith %}{# uuid4_re #} {% endblock %} 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 4b4f705a75..769f49383d 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 @@ -1,5 +1,6 @@ {% macro grpc_required_tests(method, service, api, full_extended_lro=False) %} {% with method_name = method.safe_name|snake_case + "_unary" if method.extended_lro and not full_extended_lro else method.safe_name|snake_case, method_output = method.extended_lro.operation_type if method.extended_lro and not full_extended_lro else method.output %} +{% with uuid4_re = "[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" %} @pytest.mark.parametrize("request_type", [ {{ method.input.ident }}, dict, @@ -144,7 +145,7 @@ def test_{{ method_name }}_empty_call(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -182,7 +183,7 @@ def test_{{ method_name }}_non_empty_request_with_auto_populated_field(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -243,7 +244,7 @@ async def test_{{ method_name }}_empty_call_async(): {% if method_settings is not none %} {% for auto_populated_field in method_settings.auto_populated_fields %} # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match(r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", args[0].{{ auto_populated_field }}) + assert re.match(r"{{ uuid4_re }}", args[0].{{ auto_populated_field }}) # clear UUID field so that the check below succeeds args[0].{{ auto_populated_field }} = None {% endfor %} @@ -1014,6 +1015,7 @@ def test_{{ method_name }}_raw_page_lro(): response = {{ method.lro.response_type.ident }}() assert response.raw_page is response {% endif %}{# method.paged_result_field #}{% endwith %} +{% endwith %}{# uuid4_re #} {% endmacro %} {% macro rest_required_tests(method, service, numeric_enums=False, full_extended_lro=False) %} diff --git a/tests/system/test_unary.py b/tests/system/test_unary.py index 35cc297d16..52c03df220 100644 --- a/tests/system/test_unary.py +++ b/tests/system/test_unary.py @@ -21,6 +21,8 @@ from google import showcase +UUID4_RE = r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" + def test_unary_with_request_object(echo): response = echo.echo(showcase.EchoRequest( @@ -41,16 +43,10 @@ def test_unary_with_request_object(echo): )) assert response.content == 'The hail in Wales falls mainly on the snails.' # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", - response.request_id, - ) + assert re.match(UUID4_RE, response.request_id) assert len(response.request_id) == 36 # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", - response.other_request_id, - ) + assert re.match(UUID4_RE, response.other_request_id) assert len(response.other_request_id) == 36 @@ -72,16 +68,10 @@ def test_unary_with_dict(echo): 'content': 'The hail in Wales falls mainly on the snails.', }) assert response.content == 'The hail in Wales falls mainly on the snails.' - assert re.match( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", - response.request_id, - ) + assert re.match(UUID4_RE, response.request_id) assert len(response.request_id) == 36 # Ensure that the uuid4 field is set according to AIP 4235 - assert re.match( - r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}", - response.other_request_id, - ) + assert re.match(UUID4_RE, response.other_request_id) assert len(response.other_request_id) == 36