From 6c645899ff751d260170bb4da0827d5ba4f98ad9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 7 Jan 2022 19:39:34 -0500 Subject: [PATCH] chore: use gapic-generator-python 0.58.4 (#218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: https://github.com/googleapis/googleapis/commit/73da6697f598f1ba30618924936a59f8e457ec89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../key_management_service/transports/base.py | 1 - .../kms_v1/test_key_management_service.py | 276 +++++------------- 2 files changed, 81 insertions(+), 196 deletions(-) diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py index 9d9d22d36d6e..75aa93357e17 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py @@ -105,7 +105,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py index 2019f42d42b9..b926fb3c31a0 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py @@ -263,20 +263,20 @@ def test_key_management_service_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -345,7 +345,7 @@ def test_key_management_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -444,7 +444,7 @@ def test_key_management_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -479,7 +479,7 @@ def test_key_management_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -512,9 +512,8 @@ def test_key_management_service_client_client_options_from_dict(): ) -def test_list_key_rings( - transport: str = "grpc", request_type=service.ListKeyRingsRequest -): +@pytest.mark.parametrize("request_type", [service.ListKeyRingsRequest, dict,]) +def test_list_key_rings(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -542,10 +541,6 @@ def test_list_key_rings( assert response.total_size == 1086 -def test_list_key_rings_from_dict(): - test_list_key_rings(request_type=dict) - - def test_list_key_rings_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. @@ -730,9 +725,9 @@ async def test_list_key_rings_flattened_error_async(): ) -def test_list_key_rings_pager(): +def test_list_key_rings_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -770,9 +765,9 @@ def test_list_key_rings_pager(): assert all(isinstance(i, resources.KeyRing) for i in results) -def test_list_key_rings_pages(): +def test_list_key_rings_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -876,9 +871,8 @@ async def test_list_key_rings_async_pages(): assert page_.raw_page.next_page_token == token -def test_list_crypto_keys( - transport: str = "grpc", request_type=service.ListCryptoKeysRequest -): +@pytest.mark.parametrize("request_type", [service.ListCryptoKeysRequest, dict,]) +def test_list_crypto_keys(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -906,10 +900,6 @@ def test_list_crypto_keys( assert response.total_size == 1086 -def test_list_crypto_keys_from_dict(): - test_list_crypto_keys(request_type=dict) - - def test_list_crypto_keys_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1094,9 +1084,9 @@ async def test_list_crypto_keys_flattened_error_async(): ) -def test_list_crypto_keys_pager(): +def test_list_crypto_keys_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1134,9 +1124,9 @@ def test_list_crypto_keys_pager(): assert all(isinstance(i, resources.CryptoKey) for i in results) -def test_list_crypto_keys_pages(): +def test_list_crypto_keys_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1240,9 +1230,8 @@ async def test_list_crypto_keys_async_pages(): assert page_.raw_page.next_page_token == token -def test_list_crypto_key_versions( - transport: str = "grpc", request_type=service.ListCryptoKeyVersionsRequest -): +@pytest.mark.parametrize("request_type", [service.ListCryptoKeyVersionsRequest, dict,]) +def test_list_crypto_key_versions(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1272,10 +1261,6 @@ def test_list_crypto_key_versions( assert response.total_size == 1086 -def test_list_crypto_key_versions_from_dict(): - test_list_crypto_key_versions(request_type=dict) - - def test_list_crypto_key_versions_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. @@ -1472,9 +1457,9 @@ async def test_list_crypto_key_versions_flattened_error_async(): ) -def test_list_crypto_key_versions_pager(): +def test_list_crypto_key_versions_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1520,9 +1505,9 @@ def test_list_crypto_key_versions_pager(): assert all(isinstance(i, resources.CryptoKeyVersion) for i in results) -def test_list_crypto_key_versions_pages(): +def test_list_crypto_key_versions_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1650,9 +1635,8 @@ async def test_list_crypto_key_versions_async_pages(): assert page_.raw_page.next_page_token == token -def test_list_import_jobs( - transport: str = "grpc", request_type=service.ListImportJobsRequest -): +@pytest.mark.parametrize("request_type", [service.ListImportJobsRequest, dict,]) +def test_list_import_jobs(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1680,10 +1664,6 @@ def test_list_import_jobs( assert response.total_size == 1086 -def test_list_import_jobs_from_dict(): - test_list_import_jobs(request_type=dict) - - def test_list_import_jobs_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. @@ -1868,9 +1848,9 @@ async def test_list_import_jobs_flattened_error_async(): ) -def test_list_import_jobs_pager(): +def test_list_import_jobs_pager(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1908,9 +1888,9 @@ def test_list_import_jobs_pager(): assert all(isinstance(i, resources.ImportJob) for i in results) -def test_list_import_jobs_pages(): +def test_list_import_jobs_pages(transport_name: str = "grpc"): client = KeyManagementServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2014,7 +1994,8 @@ async def test_list_import_jobs_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_key_ring(transport: str = "grpc", request_type=service.GetKeyRingRequest): +@pytest.mark.parametrize("request_type", [service.GetKeyRingRequest, dict,]) +def test_get_key_ring(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2039,10 +2020,6 @@ def test_get_key_ring(transport: str = "grpc", request_type=service.GetKeyRingRe assert response.name == "name_value" -def test_get_key_ring_from_dict(): - test_get_key_ring(request_type=dict) - - def test_get_key_ring_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. @@ -2220,9 +2197,8 @@ async def test_get_key_ring_flattened_error_async(): ) -def test_get_crypto_key( - transport: str = "grpc", request_type=service.GetCryptoKeyRequest -): +@pytest.mark.parametrize("request_type", [service.GetCryptoKeyRequest, dict,]) +def test_get_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2254,10 +2230,6 @@ def test_get_crypto_key( assert response.import_only is True -def test_get_crypto_key_from_dict(): - test_get_crypto_key(request_type=dict) - - def test_get_crypto_key_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. @@ -2441,9 +2413,8 @@ async def test_get_crypto_key_flattened_error_async(): ) -def test_get_crypto_key_version( - transport: str = "grpc", request_type=service.GetCryptoKeyVersionRequest -): +@pytest.mark.parametrize("request_type", [service.GetCryptoKeyVersionRequest, dict,]) +def test_get_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2490,10 +2461,6 @@ def test_get_crypto_key_version( assert response.reimport_eligible is True -def test_get_crypto_key_version_from_dict(): - test_get_crypto_key_version(request_type=dict) - - def test_get_crypto_key_version_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. @@ -2707,9 +2674,8 @@ async def test_get_crypto_key_version_flattened_error_async(): ) -def test_get_public_key( - transport: str = "grpc", request_type=service.GetPublicKeyRequest -): +@pytest.mark.parametrize("request_type", [service.GetPublicKeyRequest, dict,]) +def test_get_public_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2745,10 +2711,6 @@ def test_get_public_key( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_get_public_key_from_dict(): - test_get_public_key(request_type=dict) - - def test_get_public_key_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. @@ -2937,9 +2899,8 @@ async def test_get_public_key_flattened_error_async(): ) -def test_get_import_job( - transport: str = "grpc", request_type=service.GetImportJobRequest -): +@pytest.mark.parametrize("request_type", [service.GetImportJobRequest, dict,]) +def test_get_import_job(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2975,10 +2936,6 @@ def test_get_import_job( assert response.state == resources.ImportJob.ImportJobState.PENDING_GENERATION -def test_get_import_job_from_dict(): - test_get_import_job(request_type=dict) - - def test_get_import_job_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. @@ -3167,9 +3124,8 @@ async def test_get_import_job_flattened_error_async(): ) -def test_create_key_ring( - transport: str = "grpc", request_type=service.CreateKeyRingRequest -): +@pytest.mark.parametrize("request_type", [service.CreateKeyRingRequest, dict,]) +def test_create_key_ring(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3194,10 +3150,6 @@ def test_create_key_ring( assert response.name == "name_value" -def test_create_key_ring_from_dict(): - test_create_key_ring(request_type=dict) - - def test_create_key_ring_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. @@ -3401,9 +3353,8 @@ async def test_create_key_ring_flattened_error_async(): ) -def test_create_crypto_key( - transport: str = "grpc", request_type=service.CreateCryptoKeyRequest -): +@pytest.mark.parametrize("request_type", [service.CreateCryptoKeyRequest, dict,]) +def test_create_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3437,10 +3388,6 @@ def test_create_crypto_key( assert response.import_only is True -def test_create_crypto_key_from_dict(): - test_create_crypto_key(request_type=dict) - - def test_create_crypto_key_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. @@ -3662,9 +3609,8 @@ async def test_create_crypto_key_flattened_error_async(): ) -def test_create_crypto_key_version( - transport: str = "grpc", request_type=service.CreateCryptoKeyVersionRequest -): +@pytest.mark.parametrize("request_type", [service.CreateCryptoKeyVersionRequest, dict,]) +def test_create_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3711,10 +3657,6 @@ def test_create_crypto_key_version( assert response.reimport_eligible is True -def test_create_crypto_key_version_from_dict(): - test_create_crypto_key_version(request_type=dict) - - def test_create_crypto_key_version_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. @@ -3944,9 +3886,8 @@ async def test_create_crypto_key_version_flattened_error_async(): ) -def test_import_crypto_key_version( - transport: str = "grpc", request_type=service.ImportCryptoKeyVersionRequest -): +@pytest.mark.parametrize("request_type", [service.ImportCryptoKeyVersionRequest, dict,]) +def test_import_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3993,10 +3934,6 @@ def test_import_crypto_key_version( assert response.reimport_eligible is True -def test_import_crypto_key_version_from_dict(): - test_import_crypto_key_version(request_type=dict) - - def test_import_crypto_key_version_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. @@ -4130,9 +4067,8 @@ async def test_import_crypto_key_version_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_create_import_job( - transport: str = "grpc", request_type=service.CreateImportJobRequest -): +@pytest.mark.parametrize("request_type", [service.CreateImportJobRequest, dict,]) +def test_create_import_job(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4170,10 +4106,6 @@ def test_create_import_job( assert response.state == resources.ImportJob.ImportJobState.PENDING_GENERATION -def test_create_import_job_from_dict(): - test_create_import_job(request_type=dict) - - def test_create_import_job_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. @@ -4400,9 +4332,8 @@ async def test_create_import_job_flattened_error_async(): ) -def test_update_crypto_key( - transport: str = "grpc", request_type=service.UpdateCryptoKeyRequest -): +@pytest.mark.parametrize("request_type", [service.UpdateCryptoKeyRequest, dict,]) +def test_update_crypto_key(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4436,10 +4367,6 @@ def test_update_crypto_key( assert response.import_only is True -def test_update_crypto_key_from_dict(): - test_update_crypto_key(request_type=dict) - - def test_update_crypto_key_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. @@ -4655,9 +4582,8 @@ async def test_update_crypto_key_flattened_error_async(): ) -def test_update_crypto_key_version( - transport: str = "grpc", request_type=service.UpdateCryptoKeyVersionRequest -): +@pytest.mark.parametrize("request_type", [service.UpdateCryptoKeyVersionRequest, dict,]) +def test_update_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4704,10 +4630,6 @@ def test_update_crypto_key_version( assert response.reimport_eligible is True -def test_update_crypto_key_version_from_dict(): - test_update_crypto_key_version(request_type=dict) - - def test_update_crypto_key_version_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. @@ -4943,9 +4865,10 @@ async def test_update_crypto_key_version_flattened_error_async(): ) -def test_update_crypto_key_primary_version( - transport: str = "grpc", request_type=service.UpdateCryptoKeyPrimaryVersionRequest -): +@pytest.mark.parametrize( + "request_type", [service.UpdateCryptoKeyPrimaryVersionRequest, dict,] +) +def test_update_crypto_key_primary_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4979,10 +4902,6 @@ def test_update_crypto_key_primary_version( assert response.import_only is True -def test_update_crypto_key_primary_version_from_dict(): - test_update_crypto_key_primary_version(request_type=dict) - - def test_update_crypto_key_primary_version_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. @@ -5193,9 +5112,10 @@ async def test_update_crypto_key_primary_version_flattened_error_async(): ) -def test_destroy_crypto_key_version( - transport: str = "grpc", request_type=service.DestroyCryptoKeyVersionRequest -): +@pytest.mark.parametrize( + "request_type", [service.DestroyCryptoKeyVersionRequest, dict,] +) +def test_destroy_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5242,10 +5162,6 @@ def test_destroy_crypto_key_version( assert response.reimport_eligible is True -def test_destroy_crypto_key_version_from_dict(): - test_destroy_crypto_key_version(request_type=dict) - - def test_destroy_crypto_key_version_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. @@ -5459,9 +5375,10 @@ async def test_destroy_crypto_key_version_flattened_error_async(): ) -def test_restore_crypto_key_version( - transport: str = "grpc", request_type=service.RestoreCryptoKeyVersionRequest -): +@pytest.mark.parametrize( + "request_type", [service.RestoreCryptoKeyVersionRequest, dict,] +) +def test_restore_crypto_key_version(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5508,10 +5425,6 @@ def test_restore_crypto_key_version( assert response.reimport_eligible is True -def test_restore_crypto_key_version_from_dict(): - test_restore_crypto_key_version(request_type=dict) - - def test_restore_crypto_key_version_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. @@ -5725,7 +5638,8 @@ async def test_restore_crypto_key_version_flattened_error_async(): ) -def test_encrypt(transport: str = "grpc", request_type=service.EncryptRequest): +@pytest.mark.parametrize("request_type", [service.EncryptRequest, dict,]) +def test_encrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5760,10 +5674,6 @@ def test_encrypt(transport: str = "grpc", request_type=service.EncryptRequest): assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_encrypt_from_dict(): - test_encrypt(request_type=dict) - - def test_encrypt_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. @@ -5963,7 +5873,8 @@ async def test_encrypt_flattened_error_async(): ) -def test_decrypt(transport: str = "grpc", request_type=service.DecryptRequest): +@pytest.mark.parametrize("request_type", [service.DecryptRequest, dict,]) +def test_decrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5994,10 +5905,6 @@ def test_decrypt(transport: str = "grpc", request_type=service.DecryptRequest): assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_decrypt_from_dict(): - test_decrypt(request_type=dict) - - def test_decrypt_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. @@ -6195,9 +6102,8 @@ async def test_decrypt_flattened_error_async(): ) -def test_asymmetric_sign( - transport: str = "grpc", request_type=service.AsymmetricSignRequest -): +@pytest.mark.parametrize("request_type", [service.AsymmetricSignRequest, dict,]) +def test_asymmetric_sign(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6232,10 +6138,6 @@ def test_asymmetric_sign( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_asymmetric_sign_from_dict(): - test_asymmetric_sign(request_type=dict) - - def test_asymmetric_sign_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. @@ -6441,9 +6343,8 @@ async def test_asymmetric_sign_flattened_error_async(): ) -def test_asymmetric_decrypt( - transport: str = "grpc", request_type=service.AsymmetricDecryptRequest -): +@pytest.mark.parametrize("request_type", [service.AsymmetricDecryptRequest, dict,]) +def test_asymmetric_decrypt(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6476,10 +6377,6 @@ def test_asymmetric_decrypt( assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_asymmetric_decrypt_from_dict(): - test_asymmetric_decrypt(request_type=dict) - - def test_asymmetric_decrypt_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. @@ -6693,7 +6590,8 @@ async def test_asymmetric_decrypt_flattened_error_async(): ) -def test_mac_sign(transport: str = "grpc", request_type=service.MacSignRequest): +@pytest.mark.parametrize("request_type", [service.MacSignRequest, dict,]) +def test_mac_sign(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6726,10 +6624,6 @@ def test_mac_sign(transport: str = "grpc", request_type=service.MacSignRequest): assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_mac_sign_from_dict(): - test_mac_sign(request_type=dict) - - def test_mac_sign_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. @@ -6927,7 +6821,8 @@ async def test_mac_sign_flattened_error_async(): ) -def test_mac_verify(transport: str = "grpc", request_type=service.MacVerifyRequest): +@pytest.mark.parametrize("request_type", [service.MacVerifyRequest, dict,]) +def test_mac_verify(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6964,10 +6859,6 @@ def test_mac_verify(transport: str = "grpc", request_type=service.MacVerifyReque assert response.protection_level == resources.ProtectionLevel.SOFTWARE -def test_mac_verify_from_dict(): - test_mac_verify(request_type=dict) - - def test_mac_verify_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. @@ -7183,9 +7074,8 @@ async def test_mac_verify_flattened_error_async(): ) -def test_generate_random_bytes( - transport: str = "grpc", request_type=service.GenerateRandomBytesRequest -): +@pytest.mark.parametrize("request_type", [service.GenerateRandomBytesRequest, dict,]) +def test_generate_random_bytes(request_type, transport: str = "grpc"): client = KeyManagementServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7212,10 +7102,6 @@ def test_generate_random_bytes( assert response.data == b"data_blob" -def test_generate_random_bytes_from_dict(): - test_generate_random_bytes(request_type=dict) - - def test_generate_random_bytes_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. @@ -8117,7 +8003,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object(