diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py index ab33fbb7864d..e549e6ef1a31 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.kms_v1.services.key_management_service import pagers from google.cloud.kms_v1.types import resources diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py index f693f31d2581..d083772749d0 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.kms_v1.services.key_management_service import pagers from google.cloud.kms_v1.types import resources @@ -403,8 +405,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 aa996a8d113e..9d9d22d36d6e 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 @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py index b8151bfd2265..0fabb11eaf3b 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py index 6cefe660b0ec..ccce24a42832 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py index 813a87d1a2da..73b284ca1a5c 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py @@ -141,6 +141,7 @@ class CryptoKey(proto.Message): [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] support automatic rotation. For other keys, this field must be omitted. + This field is a member of `oneof`_ ``rotation_schedule``. version_template (google.cloud.kms_v1.types.CryptoKeyVersionTemplate): A template describing settings for new diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py index 4374489e84d4..b36736549dfe 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py @@ -576,6 +576,7 @@ class ImportCryptoKeyVersionRequest(proto.Message): This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP. + This field is a member of `oneof`_ ``wrapped_key_material``. """ @@ -1548,14 +1549,17 @@ class Digest(proto.Message): sha256 (bytes): A message digest produced with the SHA-256 algorithm. + This field is a member of `oneof`_ ``digest``. sha384 (bytes): A message digest produced with the SHA-384 algorithm. + This field is a member of `oneof`_ ``digest``. sha512 (bytes): A message digest produced with the SHA-512 algorithm. + This field is a member of `oneof`_ ``digest``. """ 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 d37391798f44..2019f42d42b9 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 @@ -671,7 +671,9 @@ def test_list_key_rings_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_key_rings_flattened_error(): @@ -709,7 +711,9 @@ async def test_list_key_rings_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1031,7 +1035,9 @@ def test_list_crypto_keys_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_crypto_keys_flattened_error(): @@ -1069,7 +1075,9 @@ async def test_list_crypto_keys_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1403,7 +1411,9 @@ def test_list_crypto_key_versions_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_crypto_key_versions_flattened_error(): @@ -1443,7 +1453,9 @@ async def test_list_crypto_key_versions_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1797,7 +1809,9 @@ def test_list_import_jobs_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_import_jobs_flattened_error(): @@ -1835,7 +1849,9 @@ async def test_list_import_jobs_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2147,7 +2163,9 @@ def test_get_key_ring_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_key_ring_flattened_error(): @@ -2183,7 +2201,9 @@ async def test_get_key_ring_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2364,7 +2384,9 @@ def test_get_crypto_key_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_crypto_key_flattened_error(): @@ -2400,7 +2422,9 @@ async def test_get_crypto_key_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2622,7 +2646,9 @@ def test_get_crypto_key_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_crypto_key_version_flattened_error(): @@ -2662,7 +2688,9 @@ async def test_get_crypto_key_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2852,7 +2880,9 @@ def test_get_public_key_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_public_key_flattened_error(): @@ -2888,7 +2918,9 @@ async def test_get_public_key_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3078,7 +3110,9 @@ def test_get_import_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_import_job_flattened_error(): @@ -3114,7 +3148,9 @@ async def test_get_import_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3286,9 +3322,15 @@ def test_create_key_ring_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].key_ring_id == "key_ring_id_value" - assert args[0].key_ring == resources.KeyRing(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].key_ring_id + mock_val = "key_ring_id_value" + assert arg == mock_val + arg = args[0].key_ring + mock_val = resources.KeyRing(name="name_value") + assert arg == mock_val def test_create_key_ring_flattened_error(): @@ -3331,9 +3373,15 @@ async def test_create_key_ring_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].key_ring_id == "key_ring_id_value" - assert args[0].key_ring == resources.KeyRing(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].key_ring_id + mock_val = "key_ring_id_value" + assert arg == mock_val + arg = args[0].key_ring + mock_val = resources.KeyRing(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3533,9 +3581,15 @@ def test_create_crypto_key_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].crypto_key_id == "crypto_key_id_value" - assert args[0].crypto_key == resources.CryptoKey(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].crypto_key_id + mock_val = "crypto_key_id_value" + assert arg == mock_val + arg = args[0].crypto_key + mock_val = resources.CryptoKey(name="name_value") + assert arg == mock_val def test_create_crypto_key_flattened_error(): @@ -3580,9 +3634,15 @@ async def test_create_crypto_key_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].crypto_key_id == "crypto_key_id_value" - assert args[0].crypto_key == resources.CryptoKey(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].crypto_key_id + mock_val = "crypto_key_id_value" + assert arg == mock_val + arg = args[0].crypto_key + mock_val = resources.CryptoKey(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3810,10 +3870,12 @@ def test_create_crypto_key_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].crypto_key_version == resources.CryptoKeyVersion( - name="name_value" - ) + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].crypto_key_version + mock_val = resources.CryptoKeyVersion(name="name_value") + assert arg == mock_val def test_create_crypto_key_version_flattened_error(): @@ -3858,10 +3920,12 @@ async def test_create_crypto_key_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].crypto_key_version == resources.CryptoKeyVersion( - name="name_value" - ) + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].crypto_key_version + mock_val = resources.CryptoKeyVersion(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -4255,9 +4319,15 @@ def test_create_import_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].import_job_id == "import_job_id_value" - assert args[0].import_job == resources.ImportJob(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].import_job_id + mock_val = "import_job_id_value" + assert arg == mock_val + arg = args[0].import_job + mock_val = resources.ImportJob(name="name_value") + assert arg == mock_val def test_create_import_job_flattened_error(): @@ -4302,9 +4372,15 @@ async def test_create_import_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].import_job_id == "import_job_id_value" - assert args[0].import_job == resources.ImportJob(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].import_job_id + mock_val = "import_job_id_value" + assert arg == mock_val + arg = args[0].import_job + mock_val = resources.ImportJob(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -4507,8 +4583,12 @@ def test_update_crypto_key_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].crypto_key == resources.CryptoKey(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].crypto_key + mock_val = resources.CryptoKey(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_crypto_key_flattened_error(): @@ -4551,8 +4631,12 @@ async def test_update_crypto_key_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].crypto_key == resources.CryptoKey(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].crypto_key + mock_val = resources.CryptoKey(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -4785,10 +4869,12 @@ def test_update_crypto_key_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].crypto_key_version == resources.CryptoKeyVersion( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].crypto_key_version + mock_val = resources.CryptoKeyVersion(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_crypto_key_version_flattened_error(): @@ -4833,10 +4919,12 @@ async def test_update_crypto_key_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].crypto_key_version == resources.CryptoKeyVersion( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].crypto_key_version + mock_val = resources.CryptoKeyVersion(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -5034,8 +5122,12 @@ def test_update_crypto_key_primary_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].crypto_key_version_id == "crypto_key_version_id_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].crypto_key_version_id + mock_val = "crypto_key_version_id_value" + assert arg == mock_val def test_update_crypto_key_primary_version_flattened_error(): @@ -5077,8 +5169,12 @@ async def test_update_crypto_key_primary_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].crypto_key_version_id == "crypto_key_version_id_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].crypto_key_version_id + mock_val = "crypto_key_version_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -5302,7 +5398,9 @@ def test_destroy_crypto_key_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_destroy_crypto_key_version_flattened_error(): @@ -5342,7 +5440,9 @@ async def test_destroy_crypto_key_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -5564,7 +5664,9 @@ def test_restore_crypto_key_version_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_restore_crypto_key_version_flattened_error(): @@ -5604,7 +5706,9 @@ async def test_restore_crypto_key_version_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -5794,8 +5898,12 @@ def test_encrypt_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].plaintext == b"plaintext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].plaintext + mock_val = b"plaintext_blob" + assert arg == mock_val def test_encrypt_flattened_error(): @@ -5833,8 +5941,12 @@ async def test_encrypt_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].plaintext == b"plaintext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].plaintext + mock_val = b"plaintext_blob" + assert arg == mock_val @pytest.mark.asyncio @@ -6016,8 +6128,12 @@ def test_decrypt_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].ciphertext == b"ciphertext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].ciphertext + mock_val = b"ciphertext_blob" + assert arg == mock_val def test_decrypt_flattened_error(): @@ -6057,8 +6173,12 @@ async def test_decrypt_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].ciphertext == b"ciphertext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].ciphertext + mock_val = b"ciphertext_blob" + assert arg == mock_val @pytest.mark.asyncio @@ -6250,8 +6370,12 @@ def test_asymmetric_sign_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].digest == service.Digest(sha256=b"sha256_blob") + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].digest + mock_val = service.Digest(sha256=b"sha256_blob") + assert arg == mock_val def test_asymmetric_sign_flattened_error(): @@ -6293,8 +6417,12 @@ async def test_asymmetric_sign_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].digest == service.Digest(sha256=b"sha256_blob") + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].digest + mock_val = service.Digest(sha256=b"sha256_blob") + assert arg == mock_val @pytest.mark.asyncio @@ -6492,8 +6620,12 @@ def test_asymmetric_decrypt_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].ciphertext == b"ciphertext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].ciphertext + mock_val = b"ciphertext_blob" + assert arg == mock_val def test_asymmetric_decrypt_flattened_error(): @@ -6537,8 +6669,12 @@ async def test_asymmetric_decrypt_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].ciphertext == b"ciphertext_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].ciphertext + mock_val = b"ciphertext_blob" + assert arg == mock_val @pytest.mark.asyncio @@ -6726,8 +6862,12 @@ def test_mac_sign_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].data == b"data_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].data + mock_val = b"data_blob" + assert arg == mock_val def test_mac_sign_flattened_error(): @@ -6765,8 +6905,12 @@ async def test_mac_sign_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].data == b"data_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].data + mock_val = b"data_blob" + assert arg == mock_val @pytest.mark.asyncio @@ -6960,9 +7104,15 @@ def test_mac_verify_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].data == b"data_blob" - assert args[0].mac == b"mac_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].data + mock_val = b"data_blob" + assert arg == mock_val + arg = args[0].mac + mock_val = b"mac_blob" + assert arg == mock_val def test_mac_verify_flattened_error(): @@ -7005,9 +7155,15 @@ async def test_mac_verify_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].data == b"data_blob" - assert args[0].mac == b"mac_blob" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].data + mock_val = b"data_blob" + assert arg == mock_val + arg = args[0].mac + mock_val = b"mac_blob" + assert arg == mock_val @pytest.mark.asyncio @@ -7196,9 +7352,15 @@ def test_generate_random_bytes_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].location == "location_value" - assert args[0].length_bytes == 1288 - assert args[0].protection_level == resources.ProtectionLevel.SOFTWARE + arg = args[0].location + mock_val = "location_value" + assert arg == mock_val + arg = args[0].length_bytes + mock_val = 1288 + assert arg == mock_val + arg = args[0].protection_level + mock_val = resources.ProtectionLevel.SOFTWARE + assert arg == mock_val def test_generate_random_bytes_flattened_error(): @@ -7245,9 +7407,15 @@ async def test_generate_random_bytes_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].location == "location_value" - assert args[0].length_bytes == 1288 - assert args[0].protection_level == resources.ProtectionLevel.SOFTWARE + arg = args[0].location + mock_val = "location_value" + assert arg == mock_val + arg = args[0].length_bytes + mock_val = 1288 + assert arg == mock_val + arg = args[0].protection_level + mock_val = resources.ProtectionLevel.SOFTWARE + assert arg == mock_val @pytest.mark.asyncio