From d367ee0d69f59e47cdc9bd24b78d7441c56ee158 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 28 Mar 2022 23:32:38 +0000 Subject: [PATCH] chore(python): use black==22.3.0 Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- .../async_client.py | 52 ++- .../binauthz_management_service_v1/client.py | 107 ++++- .../transports/base.py | 10 +- .../transports/grpc.py | 3 +- .../services/system_policy_v1/async_client.py | 7 +- .../services/system_policy_v1/client.py | 56 ++- .../system_policy_v1/transports/base.py | 10 +- .../system_policy_v1/transports/grpc.py | 3 +- .../validation_helper_v1/async_client.py | 7 +- .../services/validation_helper_v1/client.py | 46 +- .../validation_helper_v1/transports/base.py | 6 +- .../validation_helper_v1/transports/grpc.py | 3 +- .../binaryauthorization_v1/types/resources.py | 135 ++++-- .../binaryauthorization_v1/types/service.py | 102 ++++- .../async_client.py | 52 ++- .../client.py | 107 ++++- .../transports/base.py | 10 +- .../transports/grpc.py | 3 +- .../system_policy_v1_beta1/async_client.py | 7 +- .../services/system_policy_v1_beta1/client.py | 54 ++- .../system_policy_v1_beta1/transports/base.py | 10 +- .../system_policy_v1_beta1/transports/grpc.py | 3 +- .../types/continuous_validation_logging.py | 37 +- .../types/resources.py | 135 ++++-- .../types/service.py | 72 ++- noxfile.py | 9 +- .../test_binauthz_management_service_v1.py | 418 +++++++++++++----- .../test_system_policy_v1.py | 126 ++++-- .../test_validation_helper_v1.py | 90 +++- ...st_binauthz_management_service_v1_beta1.py | 408 ++++++++++++----- .../test_system_policy_v1_beta1.py | 110 +++-- 33 files changed, 1686 insertions(+), 519 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..87dd006 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 3e51f11..3551c21 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index 87a44fb..ce37151 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -333,7 +333,12 @@ def sample_get_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -451,7 +456,12 @@ def sample_update_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -581,7 +591,12 @@ def sample_create_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -688,7 +703,12 @@ def sample_get_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -804,7 +824,12 @@ def sample_update_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -912,12 +937,20 @@ def sample_list_attestors(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAttestorsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1016,7 +1049,10 @@ def sample_delete_attestor(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py index bf06a79..806177d 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py @@ -62,7 +62,8 @@ class BinauthzManagementServiceV1ClientMeta(type): ] = BinauthzManagementServiceV1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BinauthzManagementServiceV1Transport]: """Returns an appropriate transport class. @@ -177,10 +178,14 @@ def transport(self) -> BinauthzManagementServiceV1Transport: return self._transport @staticmethod - def attestor_path(project: str, attestor: str,) -> str: + def attestor_path( + project: str, + attestor: str, + ) -> str: """Returns a fully-qualified attestor string.""" return "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) @staticmethod @@ -190,9 +195,13 @@ def parse_attestor_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -201,7 +210,9 @@ def parse_policy_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -214,9 +225,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -225,9 +240,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -236,9 +255,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -247,10 +270,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -521,7 +548,12 @@ def sample_get_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -629,7 +661,12 @@ def sample_update_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -759,7 +796,12 @@ def sample_create_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -856,7 +898,12 @@ def sample_get_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -962,7 +1009,12 @@ def sample_update_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1060,12 +1112,20 @@ def sample_list_attestors(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAttestorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1154,7 +1214,10 @@ def sample_delete_attestor(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py index 8ca9c25..335e67b 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/base.py @@ -153,7 +153,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_attestor: gapic_v1.method.wrap_method( - self.create_attestor, default_timeout=600.0, client_info=client_info, + self.create_attestor, + default_timeout=600.0, + client_info=client_info, ), self.get_attestor: gapic_v1.method.wrap_method( self.get_attestor, @@ -220,9 +222,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py index aaa204c..e390357 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py @@ -232,8 +232,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index 13997b9..51c8d66 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -291,7 +291,12 @@ def sample_get_system_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py index e8f4d10..0d80e13 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py @@ -56,7 +56,10 @@ class SystemPolicyV1ClientMeta(type): _transport_registry["grpc"] = SystemPolicyV1GrpcTransport _transport_registry["grpc_asyncio"] = SystemPolicyV1GrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[SystemPolicyV1Transport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SystemPolicyV1Transport]: """Returns an appropriate transport class. Args: @@ -161,9 +164,13 @@ def transport(self) -> SystemPolicyV1Transport: return self._transport @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -172,7 +179,9 @@ def parse_policy_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -185,9 +194,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -196,9 +209,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -207,9 +224,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -218,10 +239,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -483,7 +508,12 @@ def sample_get_system_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py index cdaedf4..89205be 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/base.py @@ -122,16 +122,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get_system_policy: gapic_v1.method.wrap_method( - self.get_system_policy, default_timeout=None, client_info=client_info, + self.get_system_policy, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py index 7706211..0e0120e 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 9858b14..4f8f5a5 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -267,7 +267,12 @@ def sample_validate_attestation_occurrence(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py index 554605d..df2e53f 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py @@ -55,7 +55,8 @@ class ValidationHelperV1ClientMeta(type): _transport_registry["grpc_asyncio"] = ValidationHelperV1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[ValidationHelperV1Transport]: """Returns an appropriate transport class. @@ -161,7 +162,9 @@ def transport(self) -> ValidationHelperV1Transport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -174,9 +177,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -185,9 +192,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -196,9 +207,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -207,10 +222,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -454,7 +473,12 @@ def sample_validate_attestation_occurrence(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py index 5268466..5a486f1 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/base.py @@ -130,9 +130,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py index ef1c5f6..166513b 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py @@ -224,8 +224,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/binaryauthorization_v1/types/resources.py b/google/cloud/binaryauthorization_v1/types/resources.py index 7838f10..1b244c9 100644 --- a/google/cloud/binaryauthorization_v1/types/resources.py +++ b/google/cloud/binaryauthorization_v1/types/resources.py @@ -94,30 +94,58 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) global_policy_evaluation_mode = proto.Field( - proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, + proto.ENUM, + number=7, + enum=GlobalPolicyEvaluationMode, ) admission_whitelist_patterns = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", + proto.MESSAGE, + number=2, + message="AdmissionWhitelistPattern", ) cluster_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=3, + message="AdmissionRule", ) kubernetes_namespace_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=10, + message="AdmissionRule", ) kubernetes_service_account_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=8, + message="AdmissionRule", ) istio_service_identity_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=9, + message="AdmissionRule", ) default_admission_rule = proto.Field( - proto.MESSAGE, number=4, message="AdmissionRule", + proto.MESSAGE, + number=4, + message="AdmissionRule", + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class AdmissionWhitelistPattern(proto.Message): @@ -135,7 +163,10 @@ class AdmissionWhitelistPattern(proto.Message): wildcard which matches subdirectories of a given entry. """ - name_pattern = proto.Field(proto.STRING, number=1,) + name_pattern = proto.Field( + proto.STRING, + number=1, + ) class AdmissionRule(proto.Message): @@ -187,9 +218,20 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field(proto.ENUM, number=1, enum=EvaluationMode,) - require_attestations_by = proto.RepeatedField(proto.STRING, number=2,) - enforcement_mode = proto.Field(proto.ENUM, number=3, enum=EnforcementMode,) + evaluation_mode = proto.Field( + proto.ENUM, + number=1, + enum=EvaluationMode, + ) + require_attestations_by = proto.RepeatedField( + proto.STRING, + number=2, + ) + enforcement_mode = proto.Field( + proto.ENUM, + number=3, + enum=EnforcementMode, + ) class Attestor(proto.Message): @@ -219,12 +261,25 @@ class Attestor(proto.Message): updated. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) user_owned_grafeas_note = proto.Field( - proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedGrafeasNote", + proto.MESSAGE, + number=3, + oneof="attestor_type", + message="UserOwnedGrafeasNote", + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) class UserOwnedGrafeasNote(proto.Message): @@ -268,11 +323,19 @@ class UserOwnedGrafeasNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field(proto.STRING, number=1,) + note_reference = proto.Field( + proto.STRING, + number=1, + ) public_keys = proto.RepeatedField( - proto.MESSAGE, number=2, message="AttestorPublicKey", + proto.MESSAGE, + number=2, + message="AttestorPublicKey", + ) + delegation_service_account_email = proto.Field( + proto.STRING, + number=3, ) - delegation_service_account_email = proto.Field(proto.STRING, number=3,) class PkixPublicKey(proto.Message): @@ -319,8 +382,15 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field(proto.STRING, number=1,) - signature_algorithm = proto.Field(proto.ENUM, number=2, enum=SignatureAlgorithm,) + public_key_pem = proto.Field( + proto.STRING, + number=1, + ) + signature_algorithm = proto.Field( + proto.ENUM, + number=2, + enum=SignatureAlgorithm, + ) class AttestorPublicKey(proto.Message): @@ -370,13 +440,24 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + comment = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) ascii_armored_pgp_public_key = proto.Field( - proto.STRING, number=3, oneof="public_key", + proto.STRING, + number=3, + oneof="public_key", ) pkix_public_key = proto.Field( - proto.MESSAGE, number=5, oneof="public_key", message="PkixPublicKey", + proto.MESSAGE, + number=5, + oneof="public_key", + message="PkixPublicKey", ) diff --git a/google/cloud/binaryauthorization_v1/types/service.py b/google/cloud/binaryauthorization_v1/types/service.py index b1a8640..eaf253c 100644 --- a/google/cloud/binaryauthorization_v1/types/service.py +++ b/google/cloud/binaryauthorization_v1/types/service.py @@ -47,7 +47,10 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdatePolicyRequest(proto.Message): @@ -63,7 +66,11 @@ class UpdatePolicyRequest(proto.Message): ``projects/*/policy``. """ - policy = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,) + policy = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Policy, + ) class CreateAttestorRequest(proto.Message): @@ -86,9 +93,19 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field(proto.STRING, number=1,) - attestor_id = proto.Field(proto.STRING, number=2,) - attestor = proto.Field(proto.MESSAGE, number=3, message=resources.Attestor,) + parent = proto.Field( + proto.STRING, + number=1, + ) + attestor_id = proto.Field( + proto.STRING, + number=2, + ) + attestor = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Attestor, + ) class GetAttestorRequest(proto.Message): @@ -101,7 +118,10 @@ class GetAttestorRequest(proto.Message): retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateAttestorRequest(proto.Message): @@ -117,7 +137,11 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field(proto.MESSAGE, number=1, message=resources.Attestor,) + attestor = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) class ListAttestorsRequest(proto.Message): @@ -141,9 +165,18 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAttestorsResponse(proto.Message): @@ -166,9 +199,14 @@ def raw_page(self): return self attestors = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.Attestor, + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeleteAttestorRequest(proto.Message): @@ -181,7 +219,10 @@ class DeleteAttestorRequest(proto.Message): delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetSystemPolicyRequest(proto.Message): @@ -194,7 +235,10 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ValidateAttestationOccurrenceRequest(proto.Message): @@ -223,12 +267,23 @@ class ValidateAttestationOccurrenceRequest(proto.Message): [Occurrence][grafeas.v1.Occurrence]. """ - attestor = proto.Field(proto.STRING, number=1,) + attestor = proto.Field( + proto.STRING, + number=1, + ) attestation = proto.Field( - proto.MESSAGE, number=2, message=attestation.AttestationOccurrence, + proto.MESSAGE, + number=2, + message=attestation.AttestationOccurrence, + ) + occurrence_note = proto.Field( + proto.STRING, + number=3, + ) + occurrence_resource_uri = proto.Field( + proto.STRING, + number=4, ) - occurrence_note = proto.Field(proto.STRING, number=3,) - occurrence_resource_uri = proto.Field(proto.STRING, number=4,) class ValidateAttestationOccurrenceResponse(proto.Message): @@ -249,8 +304,15 @@ class Result(proto.Enum): VERIFIED = 1 ATTESTATION_NOT_VERIFIABLE = 2 - result = proto.Field(proto.ENUM, number=1, enum=Result,) - denial_reason = proto.Field(proto.STRING, number=2,) + result = proto.Field( + proto.ENUM, + number=1, + enum=Result, + ) + denial_reason = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 51eb8e0..8662108 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -343,7 +343,12 @@ def sample_get_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -462,7 +467,12 @@ def sample_update_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -593,7 +603,12 @@ def sample_create_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -700,7 +715,12 @@ def sample_get_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -816,7 +836,12 @@ def sample_update_attestor(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -925,12 +950,20 @@ def sample_list_attestors(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAttestorsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1029,7 +1062,10 @@ def sample_delete_attestor(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py index 7e2a9fa..3d4f261 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py @@ -67,7 +67,8 @@ class BinauthzManagementServiceV1Beta1ClientMeta(type): ] = BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BinauthzManagementServiceV1Beta1Transport]: """Returns an appropriate transport class. @@ -182,10 +183,14 @@ def transport(self) -> BinauthzManagementServiceV1Beta1Transport: return self._transport @staticmethod - def attestor_path(project: str, attestor: str,) -> str: + def attestor_path( + project: str, + attestor: str, + ) -> str: """Returns a fully-qualified attestor string.""" return "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) @staticmethod @@ -195,9 +200,13 @@ def parse_attestor_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -206,7 +215,9 @@ def parse_policy_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -219,9 +230,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -230,9 +245,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -241,9 +260,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -252,10 +275,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -529,7 +556,12 @@ def sample_get_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,7 +670,12 @@ def sample_update_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -769,7 +806,12 @@ def sample_create_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -866,7 +908,12 @@ def sample_get_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -972,7 +1019,12 @@ def sample_update_attestor(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1071,12 +1123,20 @@ def sample_list_attestors(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAttestorsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1165,7 +1225,10 @@ def sample_delete_attestor(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py index dd724ae..5555449 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/base.py @@ -153,7 +153,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_attestor: gapic_v1.method.wrap_method( - self.create_attestor, default_timeout=600.0, client_info=client_info, + self.create_attestor, + default_timeout=600.0, + client_info=client_info, ), self.get_attestor: gapic_v1.method.wrap_method( self.get_attestor, @@ -220,9 +222,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py index f89bb42..c9a0b6e 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py @@ -234,8 +234,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index c5319ae..ec901b0 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -293,7 +293,12 @@ def sample_get_system_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py index 9195fca..bd0f7a8 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py @@ -57,7 +57,8 @@ class SystemPolicyV1Beta1ClientMeta(type): _transport_registry["grpc_asyncio"] = SystemPolicyV1Beta1GrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SystemPolicyV1Beta1Transport]: """Returns an appropriate transport class. @@ -163,9 +164,13 @@ def transport(self) -> SystemPolicyV1Beta1Transport: return self._transport @staticmethod - def policy_path(project: str,) -> str: + def policy_path( + project: str, + ) -> str: """Returns a fully-qualified policy string.""" - return "projects/{project}/policy".format(project=project,) + return "projects/{project}/policy".format( + project=project, + ) @staticmethod def parse_policy_path(path: str) -> Dict[str, str]: @@ -174,7 +179,9 @@ def parse_policy_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -187,9 +194,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -198,9 +209,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -209,9 +224,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -220,10 +239,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -486,7 +509,12 @@ def sample_get_system_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py index c770144..8db9662 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/base.py @@ -122,16 +122,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get_system_policy: gapic_v1.method.wrap_method( - self.get_system_policy, default_timeout=None, client_info=client_info, + self.get_system_policy, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py index 0d5d12a..a77287f 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py index d197207..f3a1f49 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py +++ b/google/cloud/binaryauthorization_v1beta1/types/continuous_validation_logging.py @@ -20,7 +20,9 @@ __protobuf__ = proto.module( package="google.cloud.binaryauthorization.v1beta1", - manifest={"ContinuousValidationEvent",}, + manifest={ + "ContinuousValidationEvent", + }, ) @@ -85,20 +87,33 @@ class AuditResult(proto.Enum): ALLOW = 1 DENY = 2 - image = proto.Field(proto.STRING, number=1,) + image = proto.Field( + proto.STRING, + number=1, + ) result = proto.Field( proto.ENUM, number=2, enum="ContinuousValidationEvent.ContinuousValidationPodEvent.ImageDetails.AuditResult", ) - description = proto.Field(proto.STRING, number=3,) + description = proto.Field( + proto.STRING, + number=3, + ) - pod = proto.Field(proto.STRING, number=1,) + pod = proto.Field( + proto.STRING, + number=1, + ) deploy_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) end_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) verdict = proto.Field( proto.ENUM, @@ -120,7 +135,10 @@ class UnsupportedPolicyEvent(proto.Message): A description of the unsupported policy. """ - description = proto.Field(proto.STRING, number=1,) + description = proto.Field( + proto.STRING, + number=1, + ) pod_event = proto.Field( proto.MESSAGE, @@ -129,7 +147,10 @@ class UnsupportedPolicyEvent(proto.Message): message=ContinuousValidationPodEvent, ) unsupported_policy_event = proto.Field( - proto.MESSAGE, number=2, oneof="event_type", message=UnsupportedPolicyEvent, + proto.MESSAGE, + number=2, + oneof="event_type", + message=UnsupportedPolicyEvent, ) diff --git a/google/cloud/binaryauthorization_v1beta1/types/resources.py b/google/cloud/binaryauthorization_v1beta1/types/resources.py index 7b57bbc..5323d0b 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/resources.py +++ b/google/cloud/binaryauthorization_v1beta1/types/resources.py @@ -93,30 +93,58 @@ class GlobalPolicyEvaluationMode(proto.Enum): ENABLE = 1 DISABLE = 2 - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) global_policy_evaluation_mode = proto.Field( - proto.ENUM, number=7, enum=GlobalPolicyEvaluationMode, + proto.ENUM, + number=7, + enum=GlobalPolicyEvaluationMode, ) admission_whitelist_patterns = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdmissionWhitelistPattern", + proto.MESSAGE, + number=2, + message="AdmissionWhitelistPattern", ) cluster_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=3, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=3, + message="AdmissionRule", ) kubernetes_namespace_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=10, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=10, + message="AdmissionRule", ) kubernetes_service_account_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=8, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=8, + message="AdmissionRule", ) istio_service_identity_admission_rules = proto.MapField( - proto.STRING, proto.MESSAGE, number=9, message="AdmissionRule", + proto.STRING, + proto.MESSAGE, + number=9, + message="AdmissionRule", ) default_admission_rule = proto.Field( - proto.MESSAGE, number=4, message="AdmissionRule", + proto.MESSAGE, + number=4, + message="AdmissionRule", + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class AdmissionWhitelistPattern(proto.Message): @@ -137,7 +165,10 @@ class AdmissionWhitelistPattern(proto.Message): i.e., ``gcr.io/nginx**`` matches ``gcr.io/nginx/image``. """ - name_pattern = proto.Field(proto.STRING, number=1,) + name_pattern = proto.Field( + proto.STRING, + number=1, + ) class AdmissionRule(proto.Message): @@ -189,9 +220,20 @@ class EnforcementMode(proto.Enum): ENFORCED_BLOCK_AND_AUDIT_LOG = 1 DRYRUN_AUDIT_LOG_ONLY = 2 - evaluation_mode = proto.Field(proto.ENUM, number=1, enum=EvaluationMode,) - require_attestations_by = proto.RepeatedField(proto.STRING, number=2,) - enforcement_mode = proto.Field(proto.ENUM, number=3, enum=EnforcementMode,) + evaluation_mode = proto.Field( + proto.ENUM, + number=1, + enum=EvaluationMode, + ) + require_attestations_by = proto.RepeatedField( + proto.STRING, + number=2, + ) + enforcement_mode = proto.Field( + proto.ENUM, + number=3, + enum=EnforcementMode, + ) class Attestor(proto.Message): @@ -219,12 +261,25 @@ class Attestor(proto.Message): updated. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=6, + ) user_owned_drydock_note = proto.Field( - proto.MESSAGE, number=3, oneof="attestor_type", message="UserOwnedDrydockNote", + proto.MESSAGE, + number=3, + oneof="attestor_type", + message="UserOwnedDrydockNote", + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) class UserOwnedDrydockNote(proto.Message): @@ -268,11 +323,19 @@ class UserOwnedDrydockNote(proto.Message): email based on a different naming pattern. """ - note_reference = proto.Field(proto.STRING, number=1,) + note_reference = proto.Field( + proto.STRING, + number=1, + ) public_keys = proto.RepeatedField( - proto.MESSAGE, number=2, message="AttestorPublicKey", + proto.MESSAGE, + number=2, + message="AttestorPublicKey", + ) + delegation_service_account_email = proto.Field( + proto.STRING, + number=3, ) - delegation_service_account_email = proto.Field(proto.STRING, number=3,) class PkixPublicKey(proto.Message): @@ -319,8 +382,15 @@ class SignatureAlgorithm(proto.Enum): ECDSA_P521_SHA512 = 11 EC_SIGN_P521_SHA512 = 11 - public_key_pem = proto.Field(proto.STRING, number=1,) - signature_algorithm = proto.Field(proto.ENUM, number=2, enum=SignatureAlgorithm,) + public_key_pem = proto.Field( + proto.STRING, + number=1, + ) + signature_algorithm = proto.Field( + proto.ENUM, + number=2, + enum=SignatureAlgorithm, + ) class AttestorPublicKey(proto.Message): @@ -370,13 +440,24 @@ class AttestorPublicKey(proto.Message): This field is a member of `oneof`_ ``public_key``. """ - comment = proto.Field(proto.STRING, number=1,) - id = proto.Field(proto.STRING, number=2,) + comment = proto.Field( + proto.STRING, + number=1, + ) + id = proto.Field( + proto.STRING, + number=2, + ) ascii_armored_pgp_public_key = proto.Field( - proto.STRING, number=3, oneof="public_key", + proto.STRING, + number=3, + oneof="public_key", ) pkix_public_key = proto.Field( - proto.MESSAGE, number=5, oneof="public_key", message="PkixPublicKey", + proto.MESSAGE, + number=5, + oneof="public_key", + message="PkixPublicKey", ) diff --git a/google/cloud/binaryauthorization_v1beta1/types/service.py b/google/cloud/binaryauthorization_v1beta1/types/service.py index 44fb077..a2ea946 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/service.py +++ b/google/cloud/binaryauthorization_v1beta1/types/service.py @@ -44,7 +44,10 @@ class GetPolicyRequest(proto.Message): retrieve, in the format ``projects/*/policy``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdatePolicyRequest(proto.Message): @@ -60,7 +63,11 @@ class UpdatePolicyRequest(proto.Message): format ``projects/*/policy``. """ - policy = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,) + policy = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Policy, + ) class CreateAttestorRequest(proto.Message): @@ -83,9 +90,19 @@ class CreateAttestorRequest(proto.Message): ``projects/*/attestors/*``. """ - parent = proto.Field(proto.STRING, number=1,) - attestor_id = proto.Field(proto.STRING, number=2,) - attestor = proto.Field(proto.MESSAGE, number=3, message=resources.Attestor,) + parent = proto.Field( + proto.STRING, + number=1, + ) + attestor_id = proto.Field( + proto.STRING, + number=2, + ) + attestor = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Attestor, + ) class GetAttestorRequest(proto.Message): @@ -98,7 +115,10 @@ class GetAttestorRequest(proto.Message): to retrieve, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateAttestorRequest(proto.Message): @@ -114,7 +134,11 @@ class UpdateAttestorRequest(proto.Message): format ``projects/*/attestors/*``. """ - attestor = proto.Field(proto.MESSAGE, number=1, message=resources.Attestor,) + attestor = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) class ListAttestorsRequest(proto.Message): @@ -138,9 +162,18 @@ class ListAttestorsRequest(proto.Message): method. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAttestorsResponse(proto.Message): @@ -163,9 +196,14 @@ def raw_page(self): return self attestors = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.Attestor, + proto.MESSAGE, + number=1, + message=resources.Attestor, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeleteAttestorRequest(proto.Message): @@ -178,7 +216,10 @@ class DeleteAttestorRequest(proto.Message): to delete, in the format ``projects/*/attestors/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetSystemPolicyRequest(proto.Message): @@ -191,7 +232,10 @@ class GetSystemPolicyRequest(proto.Message): associated with a project. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..3addb4e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index d6b257b..f538d30 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -99,7 +99,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( "client_class", - [BinauthzManagementServiceV1Client, BinauthzManagementServiceV1AsyncClient,], + [ + BinauthzManagementServiceV1Client, + BinauthzManagementServiceV1AsyncClient, + ], ) def test_binauthz_management_service_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -142,7 +145,10 @@ def test_binauthz_management_service_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( "client_class", - [BinauthzManagementServiceV1Client, BinauthzManagementServiceV1AsyncClient,], + [ + BinauthzManagementServiceV1Client, + BinauthzManagementServiceV1AsyncClient, + ], ) def test_binauthz_management_service_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -531,7 +537,9 @@ def test_binauthz_management_service_v1_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -671,10 +679,17 @@ def test_binauthz_management_service_v1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest, + dict, + ], +) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -710,7 +725,8 @@ def test_get_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -726,7 +742,8 @@ async def test_get_policy_async( transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -788,7 +805,10 @@ def test_get_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -815,7 +835,10 @@ async def test_get_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_policy_flattened(): @@ -829,7 +852,9 @@ def test_get_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_policy(name="name_value",) + client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -849,7 +874,8 @@ def test_get_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) @@ -867,7 +893,9 @@ async def test_get_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_policy(name="name_value",) + response = await client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -888,14 +916,22 @@ async def test_get_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdatePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest, + dict, + ], +) def test_update_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -931,7 +967,8 @@ def test_update_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -947,7 +984,8 @@ async def test_update_policy_async( transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1009,7 +1047,10 @@ def test_update_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1036,7 +1077,10 @@ async def test_update_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] def test_update_policy_flattened(): @@ -1050,7 +1094,9 @@ def test_update_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_policy(policy=resources.Policy(name="name_value"),) + client.update_policy( + policy=resources.Policy(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1070,7 +1116,8 @@ def test_update_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) @@ -1111,14 +1158,22 @@ async def test_update_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) -@pytest.mark.parametrize("request_type", [service.CreateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest, + dict, + ], +) def test_create_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1152,7 +1207,8 @@ def test_create_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1168,7 +1224,8 @@ async def test_create_attestor_async( transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1179,7 +1236,10 @@ async def test_create_attestor_async( with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.create_attestor(request) @@ -1222,7 +1282,10 @@ def test_create_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1249,7 +1312,10 @@ async def test_create_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_attestor_flattened(): @@ -1352,10 +1418,17 @@ async def test_create_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.GetAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest, + dict, + ], +) def test_get_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1389,7 +1462,8 @@ def test_get_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1405,7 +1479,8 @@ async def test_get_attestor_async( transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1416,7 +1491,10 @@ async def test_get_attestor_async( with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.get_attestor(request) @@ -1459,7 +1537,10 @@ def test_get_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1486,7 +1567,10 @@ async def test_get_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_attestor_flattened(): @@ -1500,7 +1584,9 @@ def test_get_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_attestor(name="name_value",) + client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1520,7 +1606,8 @@ def test_get_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) @@ -1538,7 +1625,9 @@ async def test_get_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Attestor()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_attestor(name="name_value",) + response = await client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1559,14 +1648,22 @@ async def test_get_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest, + dict, + ], +) def test_update_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1600,7 +1697,8 @@ def test_update_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1616,7 +1714,8 @@ async def test_update_attestor_async( transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1627,7 +1726,10 @@ async def test_update_attestor_async( with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.update_attestor(request) @@ -1670,9 +1772,10 @@ def test_update_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1699,9 +1802,10 @@ async def test_update_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] def test_update_attestor_flattened(): @@ -1715,7 +1819,9 @@ def test_update_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_attestor(attestor=resources.Attestor(name="name_value"),) + client.update_attestor( + attestor=resources.Attestor(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1782,10 +1888,17 @@ async def test_update_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.ListAttestorsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest, + dict, + ], +) def test_list_attestors(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1814,7 +1927,8 @@ def test_list_attestors_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1830,7 +1944,8 @@ async def test_list_attestors_async( transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1841,7 +1956,9 @@ async def test_list_attestors_async( with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.ListAttestorsResponse(next_page_token="next_page_token_value",) + service.ListAttestorsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_attestors(request) @@ -1883,7 +2000,10 @@ def test_list_attestors_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1912,7 +2032,10 @@ async def test_list_attestors_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_attestors_flattened(): @@ -1926,7 +2049,9 @@ def test_list_attestors_flattened(): call.return_value = service.ListAttestorsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_attestors(parent="parent_value",) + client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1946,7 +2071,8 @@ def test_list_attestors_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) @@ -1966,7 +2092,9 @@ async def test_list_attestors_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_attestors(parent="parent_value",) + response = await client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1987,13 +2115,15 @@ async def test_list_attestors_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) def test_list_attestors_pager(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2008,12 +2138,21 @@ def test_list_attestors_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2033,7 +2172,8 @@ def test_list_attestors_pager(transport_name: str = "grpc"): def test_list_attestors_pages(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2048,12 +2188,21 @@ def test_list_attestors_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2082,16 +2231,27 @@ async def test_list_attestors_async_pager(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) - async_pager = await client.list_attestors(request={},) + async_pager = await client.list_attestors( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2121,12 +2281,21 @@ async def test_list_attestors_async_pages(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2137,10 +2306,17 @@ async def test_list_attestors_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.DeleteAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest, + dict, + ], +) def test_delete_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2166,7 +2342,8 @@ def test_delete_attestor_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 = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2182,7 +2359,8 @@ async def test_delete_attestor_async( transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest ): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2232,7 +2410,10 @@ def test_delete_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2259,7 +2440,10 @@ async def test_delete_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_attestor_flattened(): @@ -2273,7 +2457,9 @@ def test_delete_attestor_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_attestor(name="name_value",) + client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2293,7 +2479,8 @@ def test_delete_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2311,7 +2498,9 @@ async def test_delete_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_attestor(name="name_value",) + response = await client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2332,7 +2521,8 @@ async def test_delete_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2343,7 +2533,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2364,7 +2555,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2381,7 +2573,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2430,7 +2623,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.BinauthzManagementServiceV1GrpcTransport, + client.transport, + transports.BinauthzManagementServiceV1GrpcTransport, ) @@ -2482,7 +2676,8 @@ def test_binauthz_management_service_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BinauthzManagementServiceV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2647,7 +2842,8 @@ def test_binauthz_management_service_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2659,7 +2855,8 @@ def test_binauthz_management_service_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2772,7 +2969,8 @@ def test_attestor_path(): project = "squid" attestor = "clam" expected = "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) actual = BinauthzManagementServiceV1Client.attestor_path(project, attestor) assert expected == actual @@ -2792,7 +2990,9 @@ def test_parse_attestor_path(): def test_policy_path(): project = "oyster" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = BinauthzManagementServiceV1Client.policy_path(project) assert expected == actual @@ -2832,7 +3032,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BinauthzManagementServiceV1Client.common_folder_path(folder) assert expected == actual @@ -2850,7 +3052,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BinauthzManagementServiceV1Client.common_organization_path(organization) assert expected == actual @@ -2868,7 +3072,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BinauthzManagementServiceV1Client.common_project_path(project) assert expected == actual @@ -2888,7 +3094,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BinauthzManagementServiceV1Client.common_location_path(project, location) assert expected == actual @@ -2913,7 +3120,8 @@ def test_client_with_default_client_info(): transports.BinauthzManagementServiceV1Transport, "_prep_wrapped_messages" ) as prep: client = BinauthzManagementServiceV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2922,7 +3130,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BinauthzManagementServiceV1Client.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2930,7 +3139,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BinauthzManagementServiceV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index dbfcc96..958d771 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -90,7 +90,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Client, SystemPolicyV1AsyncClient,] + "client_class", + [ + SystemPolicyV1Client, + SystemPolicyV1AsyncClient, + ], ) def test_system_policy_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -132,7 +136,11 @@ def test_system_policy_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Client, SystemPolicyV1AsyncClient,] + "client_class", + [ + SystemPolicyV1Client, + SystemPolicyV1AsyncClient, + ], ) def test_system_policy_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -496,7 +504,9 @@ def test_system_policy_v1_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -636,10 +646,17 @@ def test_system_policy_v1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest, + dict, + ], +) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -677,7 +694,8 @@ def test_get_system_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -695,7 +713,8 @@ async def test_get_system_policy_async( transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest ): client = SystemPolicyV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -737,7 +756,9 @@ async def test_get_system_policy_async_from_dict(): def test_get_system_policy_field_headers(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -759,7 +780,10 @@ def test_get_system_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -788,11 +812,16 @@ async def test_get_system_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_system_policy_flattened(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -802,7 +831,9 @@ def test_get_system_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_system_policy(name="name_value",) + client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -814,13 +845,16 @@ def test_get_system_policy_flattened(): def test_get_system_policy_flattened_error(): - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -840,7 +874,9 @@ async def test_get_system_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_system_policy(name="name_value",) + response = await client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -861,7 +897,8 @@ async def test_get_system_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -872,7 +909,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -892,7 +930,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SystemPolicyV1Client(client_options=options, transport=transport,) + client = SystemPolicyV1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -908,7 +949,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -953,8 +995,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = SystemPolicyV1Client(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.SystemPolicyV1GrpcTransport,) + client = SystemPolicyV1Client( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.SystemPolicyV1GrpcTransport, + ) def test_system_policy_v1_base_transport_error(): @@ -997,7 +1044,8 @@ def test_system_policy_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SystemPolicyV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1155,7 +1203,8 @@ def test_system_policy_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1167,7 +1216,8 @@ def test_system_policy_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1276,7 +1326,9 @@ def test_system_policy_v1_transport_channel_mtls_with_adc(transport_class): def test_policy_path(): project = "squid" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = SystemPolicyV1Client.policy_path(project) assert expected == actual @@ -1314,7 +1366,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SystemPolicyV1Client.common_folder_path(folder) assert expected == actual @@ -1332,7 +1386,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SystemPolicyV1Client.common_organization_path(organization) assert expected == actual @@ -1350,7 +1406,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SystemPolicyV1Client.common_project_path(project) assert expected == actual @@ -1370,7 +1428,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SystemPolicyV1Client.common_location_path(project, location) assert expected == actual @@ -1395,7 +1454,8 @@ def test_client_with_default_client_info(): transports.SystemPolicyV1Transport, "_prep_wrapped_messages" ) as prep: client = SystemPolicyV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1404,7 +1464,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SystemPolicyV1Client.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1412,7 +1473,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SystemPolicyV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 4370b69..041cb23 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -91,7 +91,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ValidationHelperV1Client, ValidationHelperV1AsyncClient,] + "client_class", + [ + ValidationHelperV1Client, + ValidationHelperV1AsyncClient, + ], ) def test_validation_helper_v1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -133,7 +137,11 @@ def test_validation_helper_v1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ValidationHelperV1Client, ValidationHelperV1AsyncClient,] + "client_class", + [ + ValidationHelperV1Client, + ValidationHelperV1AsyncClient, + ], ) def test_validation_helper_v1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -507,7 +515,9 @@ def test_validation_helper_v1_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -648,11 +658,16 @@ def test_validation_helper_v1_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [service.ValidateAttestationOccurrenceRequest, dict,] + "request_type", + [ + service.ValidateAttestationOccurrenceRequest, + dict, + ], ) def test_validate_attestation_occurrence(request_type, transport: str = "grpc"): client = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -687,7 +702,8 @@ def test_validate_attestation_occurrence_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 = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -706,7 +722,8 @@ async def test_validate_attestation_occurrence_async( request_type=service.ValidateAttestationOccurrenceRequest, ): client = ValidationHelperV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -769,7 +786,10 @@ def test_validate_attestation_occurrence_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor=attestor/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "attestor=attestor/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -800,7 +820,10 @@ async def test_validate_attestation_occurrence_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor=attestor/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "attestor=attestor/value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -810,7 +833,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -830,7 +854,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ValidationHelperV1Client(client_options=options, transport=transport,) + client = ValidationHelperV1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -846,7 +873,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ValidationHelperV1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -894,7 +922,10 @@ def test_transport_grpc_default(): client = ValidationHelperV1Client( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.ValidationHelperV1GrpcTransport,) + assert isinstance( + client.transport, + transports.ValidationHelperV1GrpcTransport, + ) def test_validation_helper_v1_base_transport_error(): @@ -937,7 +968,8 @@ def test_validation_helper_v1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ValidationHelperV1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1097,7 +1129,8 @@ def test_validation_helper_v1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ValidationHelperV1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1109,7 +1142,8 @@ def test_validation_helper_v1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ValidationHelperV1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1238,7 +1272,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ValidationHelperV1Client.common_folder_path(folder) assert expected == actual @@ -1256,7 +1292,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ValidationHelperV1Client.common_organization_path(organization) assert expected == actual @@ -1274,7 +1312,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ValidationHelperV1Client.common_project_path(project) assert expected == actual @@ -1294,7 +1334,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ValidationHelperV1Client.common_location_path(project, location) assert expected == actual @@ -1319,7 +1360,8 @@ def test_client_with_default_client_info(): transports.ValidationHelperV1Transport, "_prep_wrapped_messages" ) as prep: client = ValidationHelperV1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1328,7 +1370,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ValidationHelperV1Client.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1336,7 +1379,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ValidationHelperV1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index c826ae7..efa7d61 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -553,7 +553,9 @@ def test_binauthz_management_service_v1_beta1_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -693,10 +695,17 @@ def test_binauthz_management_service_v1_beta1_client_create_channel_credentials_ ) -@pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetPolicyRequest, + dict, + ], +) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -732,7 +741,8 @@ def test_get_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -748,7 +758,8 @@ async def test_get_policy_async( transport: str = "grpc_asyncio", request_type=service.GetPolicyRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -810,7 +821,10 @@ def test_get_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -837,7 +851,10 @@ async def test_get_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_policy_flattened(): @@ -851,7 +868,9 @@ def test_get_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_policy(name="name_value",) + client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -871,7 +890,8 @@ def test_get_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) @@ -889,7 +909,9 @@ async def test_get_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_policy(name="name_value",) + response = await client.get_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -910,14 +932,22 @@ async def test_get_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_policy( - service.GetPolicyRequest(), name="name_value", + service.GetPolicyRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdatePolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdatePolicyRequest, + dict, + ], +) def test_update_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -953,7 +983,8 @@ def test_update_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -969,7 +1000,8 @@ async def test_update_policy_async( transport: str = "grpc_asyncio", request_type=service.UpdatePolicyRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1031,7 +1063,10 @@ def test_update_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1058,7 +1093,10 @@ async def test_update_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "policy.name=policy.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "policy.name=policy.name/value", + ) in kw["metadata"] def test_update_policy_flattened(): @@ -1072,7 +1110,9 @@ def test_update_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_policy(policy=resources.Policy(name="name_value"),) + client.update_policy( + policy=resources.Policy(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1092,7 +1132,8 @@ def test_update_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) @@ -1133,14 +1174,22 @@ async def test_update_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.update_policy( - service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"), + service.UpdatePolicyRequest(), + policy=resources.Policy(name="name_value"), ) -@pytest.mark.parametrize("request_type", [service.CreateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateAttestorRequest, + dict, + ], +) def test_create_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1174,7 +1223,8 @@ def test_create_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1190,7 +1240,8 @@ async def test_create_attestor_async( transport: str = "grpc_asyncio", request_type=service.CreateAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1201,7 +1252,10 @@ async def test_create_attestor_async( with mock.patch.object(type(client.transport.create_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.create_attestor(request) @@ -1244,7 +1298,10 @@ def test_create_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1271,7 +1328,10 @@ async def test_create_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_attestor_flattened(): @@ -1374,10 +1434,17 @@ async def test_create_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.GetAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetAttestorRequest, + dict, + ], +) def test_get_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1411,7 +1478,8 @@ def test_get_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1427,7 +1495,8 @@ async def test_get_attestor_async( transport: str = "grpc_asyncio", request_type=service.GetAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1438,7 +1507,10 @@ async def test_get_attestor_async( with mock.patch.object(type(client.transport.get_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.get_attestor(request) @@ -1481,7 +1553,10 @@ def test_get_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1508,7 +1583,10 @@ async def test_get_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_attestor_flattened(): @@ -1522,7 +1600,9 @@ def test_get_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_attestor(name="name_value",) + client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1542,7 +1622,8 @@ def test_get_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) @@ -1560,7 +1641,9 @@ async def test_get_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Attestor()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_attestor(name="name_value",) + response = await client.get_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1581,14 +1664,22 @@ async def test_get_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_attestor( - service.GetAttestorRequest(), name="name_value", + service.GetAttestorRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [service.UpdateAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateAttestorRequest, + dict, + ], +) def test_update_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1622,7 +1713,8 @@ def test_update_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1638,7 +1730,8 @@ async def test_update_attestor_async( transport: str = "grpc_asyncio", request_type=service.UpdateAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1649,7 +1742,10 @@ async def test_update_attestor_async( with mock.patch.object(type(client.transport.update_attestor), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.Attestor(name="name_value", description="description_value",) + resources.Attestor( + name="name_value", + description="description_value", + ) ) response = await client.update_attestor(request) @@ -1692,9 +1788,10 @@ def test_update_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1721,9 +1818,10 @@ async def test_update_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "attestor.name=attestor.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "attestor.name=attestor.name/value", + ) in kw["metadata"] def test_update_attestor_flattened(): @@ -1737,7 +1835,9 @@ def test_update_attestor_flattened(): call.return_value = resources.Attestor() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_attestor(attestor=resources.Attestor(name="name_value"),) + client.update_attestor( + attestor=resources.Attestor(name="name_value"), + ) # Establish that the underlying call was made with the expected # request object values. @@ -1804,10 +1904,17 @@ async def test_update_attestor_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [service.ListAttestorsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListAttestorsRequest, + dict, + ], +) def test_list_attestors(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1836,7 +1943,8 @@ def test_list_attestors_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1852,7 +1960,8 @@ async def test_list_attestors_async( transport: str = "grpc_asyncio", request_type=service.ListAttestorsRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1863,7 +1972,9 @@ async def test_list_attestors_async( with mock.patch.object(type(client.transport.list_attestors), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.ListAttestorsResponse(next_page_token="next_page_token_value",) + service.ListAttestorsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_attestors(request) @@ -1905,7 +2016,10 @@ def test_list_attestors_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1934,7 +2048,10 @@ async def test_list_attestors_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_attestors_flattened(): @@ -1948,7 +2065,9 @@ def test_list_attestors_flattened(): call.return_value = service.ListAttestorsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_attestors(parent="parent_value",) + client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1968,7 +2087,8 @@ def test_list_attestors_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) @@ -1988,7 +2108,9 @@ async def test_list_attestors_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_attestors(parent="parent_value",) + response = await client.list_attestors( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2009,13 +2131,15 @@ async def test_list_attestors_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_attestors( - service.ListAttestorsRequest(), parent="parent_value", + service.ListAttestorsRequest(), + parent="parent_value", ) def test_list_attestors_pager(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2030,12 +2154,21 @@ def test_list_attestors_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2055,7 +2188,8 @@ def test_list_attestors_pager(transport_name: str = "grpc"): def test_list_attestors_pages(transport_name: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2070,12 +2204,21 @@ def test_list_attestors_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2104,16 +2247,27 @@ async def test_list_attestors_async_pager(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) - async_pager = await client.list_attestors(request={},) + async_pager = await client.list_attestors( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -2143,12 +2297,21 @@ async def test_list_attestors_async_pages(): ], next_page_token="abc", ), - service.ListAttestorsResponse(attestors=[], next_page_token="def",), service.ListAttestorsResponse( - attestors=[resources.Attestor(),], next_page_token="ghi", + attestors=[], + next_page_token="def", ), service.ListAttestorsResponse( - attestors=[resources.Attestor(), resources.Attestor(),], + attestors=[ + resources.Attestor(), + ], + next_page_token="ghi", + ), + service.ListAttestorsResponse( + attestors=[ + resources.Attestor(), + resources.Attestor(), + ], ), RuntimeError, ) @@ -2159,10 +2322,17 @@ async def test_list_attestors_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [service.DeleteAttestorRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.DeleteAttestorRequest, + dict, + ], +) def test_delete_attestor(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2188,7 +2358,8 @@ def test_delete_attestor_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 = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2204,7 +2375,8 @@ async def test_delete_attestor_async( transport: str = "grpc_asyncio", request_type=service.DeleteAttestorRequest ): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2254,7 +2426,10 @@ def test_delete_attestor_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2281,7 +2456,10 @@ async def test_delete_attestor_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_attestor_flattened(): @@ -2295,7 +2473,9 @@ def test_delete_attestor_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_attestor(name="name_value",) + client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2315,7 +2495,8 @@ def test_delete_attestor_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2333,7 +2514,9 @@ async def test_delete_attestor_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_attestor(name="name_value",) + response = await client.delete_attestor( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2354,7 +2537,8 @@ async def test_delete_attestor_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_attestor( - service.DeleteAttestorRequest(), name="name_value", + service.DeleteAttestorRequest(), + name="name_value", ) @@ -2365,7 +2549,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2386,7 +2571,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2403,7 +2589,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BinauthzManagementServiceV1Beta1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2452,7 +2639,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.BinauthzManagementServiceV1Beta1GrpcTransport, + client.transport, + transports.BinauthzManagementServiceV1Beta1GrpcTransport, ) @@ -2504,7 +2692,8 @@ def test_binauthz_management_service_v1_beta1_base_transport_with_credentials_fi Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BinauthzManagementServiceV1Beta1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2669,7 +2858,8 @@ def test_binauthz_management_service_v1_beta1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1Beta1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2681,7 +2871,8 @@ def test_binauthz_management_service_v1_beta1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2794,7 +2985,8 @@ def test_attestor_path(): project = "squid" attestor = "clam" expected = "projects/{project}/attestors/{attestor}".format( - project=project, attestor=attestor, + project=project, + attestor=attestor, ) actual = BinauthzManagementServiceV1Beta1Client.attestor_path(project, attestor) assert expected == actual @@ -2814,7 +3006,9 @@ def test_parse_attestor_path(): def test_policy_path(): project = "oyster" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = BinauthzManagementServiceV1Beta1Client.policy_path(project) assert expected == actual @@ -2858,7 +3052,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BinauthzManagementServiceV1Beta1Client.common_folder_path(folder) assert expected == actual @@ -2876,7 +3072,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BinauthzManagementServiceV1Beta1Client.common_organization_path( organization ) @@ -2896,7 +3094,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BinauthzManagementServiceV1Beta1Client.common_project_path(project) assert expected == actual @@ -2916,7 +3116,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BinauthzManagementServiceV1Beta1Client.common_location_path( project, location @@ -2943,7 +3144,8 @@ def test_client_with_default_client_info(): transports.BinauthzManagementServiceV1Beta1Transport, "_prep_wrapped_messages" ) as prep: client = BinauthzManagementServiceV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2952,7 +3154,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BinauthzManagementServiceV1Beta1Client.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2960,7 +3163,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BinauthzManagementServiceV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index 39d4ce9..a33fba8 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -93,7 +93,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Beta1Client, SystemPolicyV1Beta1AsyncClient,] + "client_class", + [ + SystemPolicyV1Beta1Client, + SystemPolicyV1Beta1AsyncClient, + ], ) def test_system_policy_v1_beta1_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -135,7 +139,11 @@ def test_system_policy_v1_beta1_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SystemPolicyV1Beta1Client, SystemPolicyV1Beta1AsyncClient,] + "client_class", + [ + SystemPolicyV1Beta1Client, + SystemPolicyV1Beta1AsyncClient, + ], ) def test_system_policy_v1_beta1_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -517,7 +525,9 @@ def test_system_policy_v1_beta1_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -657,10 +667,17 @@ def test_system_policy_v1_beta1_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetSystemPolicyRequest, + dict, + ], +) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -698,7 +715,8 @@ def test_get_system_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -716,7 +734,8 @@ async def test_get_system_policy_async( transport: str = "grpc_asyncio", request_type=service.GetSystemPolicyRequest ): client = SystemPolicyV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -782,7 +801,10 @@ def test_get_system_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -811,7 +833,10 @@ async def test_get_system_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_system_policy_flattened(): @@ -827,7 +852,9 @@ def test_get_system_policy_flattened(): call.return_value = resources.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_system_policy(name="name_value",) + client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -847,7 +874,8 @@ def test_get_system_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -867,7 +895,9 @@ async def test_get_system_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_system_policy(name="name_value",) + response = await client.get_system_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -888,7 +918,8 @@ async def test_get_system_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_system_policy( - service.GetSystemPolicyRequest(), name="name_value", + service.GetSystemPolicyRequest(), + name="name_value", ) @@ -899,7 +930,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -919,7 +951,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SystemPolicyV1Beta1Client(client_options=options, transport=transport,) + client = SystemPolicyV1Beta1Client( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -935,7 +970,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SystemPolicyV1Beta1Client( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -983,7 +1019,10 @@ def test_transport_grpc_default(): client = SystemPolicyV1Beta1Client( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.SystemPolicyV1Beta1GrpcTransport,) + assert isinstance( + client.transport, + transports.SystemPolicyV1Beta1GrpcTransport, + ) def test_system_policy_v1_beta1_base_transport_error(): @@ -1026,7 +1065,8 @@ def test_system_policy_v1_beta1_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SystemPolicyV1Beta1Transport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1186,7 +1226,8 @@ def test_system_policy_v1_beta1_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1Beta1GrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1198,7 +1239,8 @@ def test_system_policy_v1_beta1_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SystemPolicyV1Beta1GrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1307,7 +1349,9 @@ def test_system_policy_v1_beta1_transport_channel_mtls_with_adc(transport_class) def test_policy_path(): project = "squid" - expected = "projects/{project}/policy".format(project=project,) + expected = "projects/{project}/policy".format( + project=project, + ) actual = SystemPolicyV1Beta1Client.policy_path(project) assert expected == actual @@ -1345,7 +1389,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SystemPolicyV1Beta1Client.common_folder_path(folder) assert expected == actual @@ -1363,7 +1409,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SystemPolicyV1Beta1Client.common_organization_path(organization) assert expected == actual @@ -1381,7 +1429,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SystemPolicyV1Beta1Client.common_project_path(project) assert expected == actual @@ -1401,7 +1451,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SystemPolicyV1Beta1Client.common_location_path(project, location) assert expected == actual @@ -1426,7 +1477,8 @@ def test_client_with_default_client_info(): transports.SystemPolicyV1Beta1Transport, "_prep_wrapped_messages" ) as prep: client = SystemPolicyV1Beta1Client( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1435,7 +1487,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SystemPolicyV1Beta1Client.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1443,7 +1496,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SystemPolicyV1Beta1AsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"