From b5c1422607686d86fe37409e053663cdcfb27945 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 00:06:25 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#75) 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 +- packages/google-cloud-iap/docs/conf.py | 13 +- .../async_client.py | 39 ++- .../client.py | 78 ++++- .../transports/base.py | 26 +- .../transports/grpc.py | 3 +- .../async_client.py | 63 +++- .../client.py | 102 ++++-- .../transports/base.py | 22 +- .../transports/grpc.py | 3 +- .../google/cloud/iap_v1/types/service.py | 203 ++++++++--- packages/google-cloud-iap/noxfile.py | 9 +- ...test_identity_aware_proxy_admin_service.py | 218 +++++++++--- ...est_identity_aware_proxy_o_auth_service.py | 315 +++++++++++++----- 14 files changed, 846 insertions(+), 250 deletions(-) diff --git a/packages/google-cloud-iap/.github/.OwlBot.lock.yaml b/packages/google-cloud-iap/.github/.OwlBot.lock.yaml index 88076277a251..87dd00611576 100644 --- a/packages/google-cloud-iap/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-iap/.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:2d13c2172a5d6129c861edaa48b60ead15aeaf58aa75e02d870c4cbdfa63aaba + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/packages/google-cloud-iap/docs/conf.py b/packages/google-cloud-iap/docs/conf.py index 1fe04ef81dc8..e24b5c674dd7 100644 --- a/packages/google-cloud-iap/docs/conf.py +++ b/packages/google-cloud-iap/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-iap", "google-cloud-iap Documentation", [author], 1,) + ( + root_doc, + "google-cloud-iap", + "google-cloud-iap Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,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/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/async_client.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/async_client.py index fbf3499b5cef..16604537614c 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/async_client.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/async_client.py @@ -334,7 +334,12 @@ def sample_set_iam_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_get_iam_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 @@ -536,7 +546,12 @@ def sample_test_iam_permissions(): ) # 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 @@ -603,7 +618,12 @@ def sample_get_iap_settings(): ) # 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 @@ -676,7 +696,12 @@ def sample_update_iap_settings(): ) # 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 @@ -690,7 +715,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/client.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/client.py index 186b24cd08b1..8a4ba2fd192d 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/client.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/client.py @@ -62,7 +62,8 @@ class IdentityAwareProxyAdminServiceClientMeta(type): ] = IdentityAwareProxyAdminServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[IdentityAwareProxyAdminServiceTransport]: """Returns an appropriate transport class. @@ -170,7 +171,9 @@ def transport(self) -> IdentityAwareProxyAdminServiceTransport: 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, @@ -183,9 +186,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]: @@ -194,9 +201,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]: @@ -205,9 +216,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]: @@ -216,10 +231,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 @@ -515,7 +534,12 @@ def sample_set_iam_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 @@ -642,7 +666,12 @@ def sample_get_iam_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 @@ -715,7 +744,12 @@ def sample_test_iam_permissions(): ) # 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 @@ -783,7 +817,12 @@ def sample_get_iap_settings(): ) # 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 @@ -857,7 +896,12 @@ def sample_update_iap_settings(): ) # 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 @@ -878,7 +922,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/base.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/base.py index b1302010e8c4..97901c3ec3c2 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/base.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -121,10 +123,14 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=None, client_info=client_info, + self.get_iam_policy, + default_timeout=None, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -132,19 +138,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_iap_settings: gapic_v1.method.wrap_method( - self.get_iap_settings, default_timeout=None, client_info=client_info, + self.get_iap_settings, + default_timeout=None, + client_info=client_info, ), self.update_iap_settings: gapic_v1.method.wrap_method( - self.update_iap_settings, default_timeout=None, client_info=client_info, + self.update_iap_settings, + 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/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/grpc.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/grpc.py index ef2c0576d34b..79d1b53e4eb4 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/grpc.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_admin_service/transports/grpc.py @@ -228,8 +228,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/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/async_client.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/async_client.py index bdaf67ced49a..380980744f28 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/async_client.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/async_client.py @@ -273,7 +273,12 @@ def sample_list_brands(): ) # 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 @@ -351,7 +356,12 @@ def sample_create_brand(): ) # 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 @@ -419,7 +429,12 @@ def sample_get_brand(): ) # 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 @@ -491,7 +506,12 @@ def sample_create_identity_aware_proxy_client(): ) # 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 @@ -563,12 +583,20 @@ def sample_list_identity_aware_proxy_clients(): ) # 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.ListIdentityAwareProxyClientsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -639,7 +667,12 @@ def sample_get_identity_aware_proxy_client(): ) # 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 @@ -710,7 +743,12 @@ def sample_reset_identity_aware_proxy_client_secret(): ) # 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 @@ -774,7 +812,10 @@ def sample_delete_identity_aware_proxy_client(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): @@ -786,7 +827,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/client.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/client.py index 5ff545aca2f3..582a1c0af1b2 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/client.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/client.py @@ -61,7 +61,8 @@ class IdentityAwareProxyOAuthServiceClientMeta(type): ] = IdentityAwareProxyOAuthServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[IdentityAwareProxyOAuthServiceTransport]: """Returns an appropriate transport class. @@ -172,7 +173,9 @@ def transport(self) -> IdentityAwareProxyOAuthServiceTransport: 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, @@ -185,9 +188,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 +203,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 +218,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 +233,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 @@ -456,7 +475,12 @@ def sample_list_brands(): ) # 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 @@ -535,7 +559,12 @@ def sample_create_brand(): ) # 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 @@ -604,7 +633,12 @@ def sample_get_brand(): ) # 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 @@ -679,7 +713,12 @@ def sample_create_identity_aware_proxy_client(): ) # 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 @@ -754,12 +793,20 @@ def sample_list_identity_aware_proxy_clients(): ) # 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.ListIdentityAwareProxyClientsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -833,7 +880,12 @@ def sample_get_identity_aware_proxy_client(): ) # 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 @@ -907,7 +959,12 @@ def sample_reset_identity_aware_proxy_client_secret(): ) # 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 @@ -974,7 +1031,10 @@ def sample_delete_identity_aware_proxy_client(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): @@ -993,7 +1053,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/base.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/base.py index 8db4945f5667..454260e22200 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/base.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/base.py @@ -30,7 +30,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iap",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iap", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -120,13 +122,19 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_brands: gapic_v1.method.wrap_method( - self.list_brands, default_timeout=None, client_info=client_info, + self.list_brands, + default_timeout=None, + client_info=client_info, ), self.create_brand: gapic_v1.method.wrap_method( - self.create_brand, default_timeout=None, client_info=client_info, + self.create_brand, + default_timeout=None, + client_info=client_info, ), self.get_brand: gapic_v1.method.wrap_method( - self.get_brand, default_timeout=None, client_info=client_info, + self.get_brand, + default_timeout=None, + client_info=client_info, ), self.create_identity_aware_proxy_client: gapic_v1.method.wrap_method( self.create_identity_aware_proxy_client, @@ -158,9 +166,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/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/grpc.py b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/grpc.py index cbab59e13f34..5ff6ced73e24 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/grpc.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/services/identity_aware_proxy_o_auth_service/transports/grpc.py @@ -229,8 +229,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/packages/google-cloud-iap/google/cloud/iap_v1/types/service.py b/packages/google-cloud-iap/google/cloud/iap_v1/types/service.py index 7666fd5ba997..7003cee2cd7e 100644 --- a/packages/google-cloud-iap/google/cloud/iap_v1/types/service.py +++ b/packages/google-cloud-iap/google/cloud/iap_v1/types/service.py @@ -58,7 +58,10 @@ class GetIapSettingsRequest(proto.Message): permission for the associated resource. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateIapSettingsRequest(proto.Message): @@ -76,9 +79,15 @@ class UpdateIapSettingsRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - iap_settings = proto.Field(proto.MESSAGE, number=1, message="IapSettings",) + iap_settings = proto.Field( + proto.MESSAGE, + number=1, + message="IapSettings", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -97,10 +106,19 @@ class IapSettings(proto.Message): settings in IAP """ - name = proto.Field(proto.STRING, number=1,) - access_settings = proto.Field(proto.MESSAGE, number=5, message="AccessSettings",) + name = proto.Field( + proto.STRING, + number=1, + ) + access_settings = proto.Field( + proto.MESSAGE, + number=5, + message="AccessSettings", + ) application_settings = proto.Field( - proto.MESSAGE, number=6, message="ApplicationSettings", + proto.MESSAGE, + number=6, + message="ApplicationSettings", ) @@ -118,9 +136,21 @@ class AccessSettings(proto.Message): Settings to configure IAP's OAuth behavior. """ - gcip_settings = proto.Field(proto.MESSAGE, number=1, message="GcipSettings",) - cors_settings = proto.Field(proto.MESSAGE, number=2, message="CorsSettings",) - oauth_settings = proto.Field(proto.MESSAGE, number=3, message="OAuthSettings",) + gcip_settings = proto.Field( + proto.MESSAGE, + number=1, + message="GcipSettings", + ) + cors_settings = proto.Field( + proto.MESSAGE, + number=2, + message="CorsSettings", + ) + oauth_settings = proto.Field( + proto.MESSAGE, + number=3, + message="OAuthSettings", + ) class GcipSettings(proto.Message): @@ -143,9 +173,14 @@ class GcipSettings(proto.Message): level. """ - tenant_ids = proto.RepeatedField(proto.STRING, number=1,) + tenant_ids = proto.RepeatedField( + proto.STRING, + number=1, + ) login_page_uri = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.StringValue, + proto.MESSAGE, + number=2, + message=wrappers_pb2.StringValue, ) @@ -162,7 +197,9 @@ class CorsSettings(proto.Message): """ allow_http_options = proto.Field( - proto.MESSAGE, number=1, message=wrappers_pb2.BoolValue, + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, ) @@ -181,7 +218,11 @@ class OAuthSettings(proto.Message): is managed by IAM policies. """ - login_hint = proto.Field(proto.MESSAGE, number=2, message=wrappers_pb2.StringValue,) + login_hint = proto.Field( + proto.MESSAGE, + number=2, + message=wrappers_pb2.StringValue, + ) class ApplicationSettings(proto.Message): @@ -199,12 +240,20 @@ class ApplicationSettings(proto.Message): but will be ignored at runtime if invalid. """ - csm_settings = proto.Field(proto.MESSAGE, number=1, message="CsmSettings",) + csm_settings = proto.Field( + proto.MESSAGE, + number=1, + message="CsmSettings", + ) access_denied_page_settings = proto.Field( - proto.MESSAGE, number=2, message="AccessDeniedPageSettings", + proto.MESSAGE, + number=2, + message="AccessDeniedPageSettings", ) cookie_domain = proto.Field( - proto.MESSAGE, number=3, message=wrappers_pb2.StringValue, + proto.MESSAGE, + number=3, + message=wrappers_pb2.StringValue, ) @@ -222,7 +271,9 @@ class CsmSettings(proto.Message): """ rctoken_aud = proto.Field( - proto.MESSAGE, number=1, message=wrappers_pb2.StringValue, + proto.MESSAGE, + number=1, + message=wrappers_pb2.StringValue, ) @@ -242,10 +293,14 @@ class AccessDeniedPageSettings(proto.Message): """ access_denied_page_uri = proto.Field( - proto.MESSAGE, number=1, message=wrappers_pb2.StringValue, + proto.MESSAGE, + number=1, + message=wrappers_pb2.StringValue, ) generate_troubleshooting_uri = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.BoolValue, + proto.MESSAGE, + number=2, + message=wrappers_pb2.BoolValue, ) @@ -258,7 +313,10 @@ class ListBrandsRequest(proto.Message): projects/{project_number/id}. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) class ListBrandsResponse(proto.Message): @@ -269,7 +327,11 @@ class ListBrandsResponse(proto.Message): Brands existing in the project. """ - brands = proto.RepeatedField(proto.MESSAGE, number=1, message="Brand",) + brands = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Brand", + ) class CreateBrandRequest(proto.Message): @@ -284,8 +346,15 @@ class CreateBrandRequest(proto.Message): Required. The brand to be created. """ - parent = proto.Field(proto.STRING, number=1,) - brand = proto.Field(proto.MESSAGE, number=2, message="Brand",) + parent = proto.Field( + proto.STRING, + number=1, + ) + brand = proto.Field( + proto.MESSAGE, + number=2, + message="Brand", + ) class GetBrandRequest(proto.Message): @@ -297,7 +366,10 @@ class GetBrandRequest(proto.Message): format: projects/{project_number/id}/brands/{brand}. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListIdentityAwareProxyClientsRequest(proto.Message): @@ -323,9 +395,18 @@ class ListIdentityAwareProxyClientsRequest(proto.Message): provided the page token. """ - 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 ListIdentityAwareProxyClientsResponse(proto.Message): @@ -345,9 +426,14 @@ def raw_page(self): return self identity_aware_proxy_clients = proto.RepeatedField( - proto.MESSAGE, number=1, message="IdentityAwareProxyClient", + proto.MESSAGE, + number=1, + message="IdentityAwareProxyClient", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class CreateIdentityAwareProxyClientRequest(proto.Message): @@ -363,9 +449,14 @@ class CreateIdentityAwareProxyClientRequest(proto.Message): created. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) identity_aware_proxy_client = proto.Field( - proto.MESSAGE, number=2, message="IdentityAwareProxyClient", + proto.MESSAGE, + number=2, + message="IdentityAwareProxyClient", ) @@ -379,7 +470,10 @@ class GetIdentityAwareProxyClientRequest(proto.Message): projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ResetIdentityAwareProxyClientSecretRequest(proto.Message): @@ -392,7 +486,10 @@ class ResetIdentityAwareProxyClientSecretRequest(proto.Message): projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteIdentityAwareProxyClientRequest(proto.Message): @@ -405,7 +502,10 @@ class DeleteIdentityAwareProxyClientRequest(proto.Message): projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class Brand(proto.Message): @@ -431,10 +531,22 @@ class Brand(proto.Message): organization only. """ - name = proto.Field(proto.STRING, number=1,) - support_email = proto.Field(proto.STRING, number=2,) - application_title = proto.Field(proto.STRING, number=3,) - org_internal_only = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + support_email = proto.Field( + proto.STRING, + number=2, + ) + application_title = proto.Field( + proto.STRING, + number=3, + ) + org_internal_only = proto.Field( + proto.BOOL, + number=4, + ) class IdentityAwareProxyClient(proto.Message): @@ -453,9 +565,18 @@ class IdentityAwareProxyClient(proto.Message): client. """ - name = proto.Field(proto.STRING, number=1,) - secret = proto.Field(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + secret = proto.Field( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-iap/noxfile.py b/packages/google-cloud-iap/noxfile.py index 2a2001c49998..3addb4ed9431 100644 --- a/packages/google-cloud-iap/noxfile.py +++ b/packages/google-cloud-iap/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/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py index c44016a4c380..f7ff7569389f 100644 --- a/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py +++ b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_admin_service.py @@ -102,7 +102,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( "client_class", - [IdentityAwareProxyAdminServiceClient, IdentityAwareProxyAdminServiceAsyncClient,], + [ + IdentityAwareProxyAdminServiceClient, + IdentityAwareProxyAdminServiceAsyncClient, + ], ) def test_identity_aware_proxy_admin_service_client_from_service_account_info( client_class, @@ -147,7 +150,10 @@ def test_identity_aware_proxy_admin_service_client_service_account_always_use_jw @pytest.mark.parametrize( "client_class", - [IdentityAwareProxyAdminServiceClient, IdentityAwareProxyAdminServiceAsyncClient,], + [ + IdentityAwareProxyAdminServiceClient, + IdentityAwareProxyAdminServiceAsyncClient, + ], ) def test_identity_aware_proxy_admin_service_client_from_service_account_file( client_class, @@ -538,7 +544,9 @@ def test_identity_aware_proxy_admin_service_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) @@ -678,10 +686,17 @@ def test_identity_aware_proxy_admin_service_client_create_channel_credentials_fi ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -691,7 +706,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -709,7 +727,8 @@ def test_set_iam_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 = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -725,7 +744,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = IdentityAwareProxyAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -736,7 +756,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -779,7 +802,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -806,7 +832,10 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): @@ -826,10 +855,17 @@ def test_set_iam_policy_from_dict_foreign(): call.assert_called() -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -839,7 +875,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -857,7 +896,8 @@ def test_get_iam_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 = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -873,7 +913,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = IdentityAwareProxyAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -884,7 +925,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -927,7 +971,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -954,7 +1001,10 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): @@ -975,11 +1025,16 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1010,7 +1065,8 @@ def test_test_iam_permissions_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 = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1029,7 +1085,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = IdentityAwareProxyAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1088,7 +1145,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1119,7 +1179,10 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): @@ -1141,10 +1204,17 @@ def test_test_iam_permissions_from_dict_foreign(): call.assert_called() -@pytest.mark.parametrize("request_type", [service.GetIapSettingsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetIapSettingsRequest, + dict, + ], +) def test_get_iap_settings(request_type, transport: str = "grpc"): client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1154,7 +1224,9 @@ def test_get_iap_settings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iap_settings), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = service.IapSettings(name="name_value",) + call.return_value = service.IapSettings( + name="name_value", + ) response = client.get_iap_settings(request) # Establish that the underlying gRPC stub method was called. @@ -1171,7 +1243,8 @@ def test_get_iap_settings_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 = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1187,7 +1260,8 @@ async def test_get_iap_settings_async( transport: str = "grpc_asyncio", request_type=service.GetIapSettingsRequest ): client = IdentityAwareProxyAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1198,7 +1272,9 @@ async def test_get_iap_settings_async( with mock.patch.object(type(client.transport.get_iap_settings), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.IapSettings(name="name_value",) + service.IapSettings( + name="name_value", + ) ) response = await client.get_iap_settings(request) @@ -1240,7 +1316,10 @@ def test_get_iap_settings_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 @@ -1267,13 +1346,23 @@ async def test_get_iap_settings_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"] -@pytest.mark.parametrize("request_type", [service.UpdateIapSettingsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.UpdateIapSettingsRequest, + dict, + ], +) def test_update_iap_settings(request_type, transport: str = "grpc"): client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1285,7 +1374,9 @@ def test_update_iap_settings(request_type, transport: str = "grpc"): type(client.transport.update_iap_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = service.IapSettings(name="name_value",) + call.return_value = service.IapSettings( + name="name_value", + ) response = client.update_iap_settings(request) # Establish that the underlying gRPC stub method was called. @@ -1302,7 +1393,8 @@ def test_update_iap_settings_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 = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1320,7 +1412,8 @@ async def test_update_iap_settings_async( transport: str = "grpc_asyncio", request_type=service.UpdateIapSettingsRequest ): client = IdentityAwareProxyAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1333,7 +1426,9 @@ async def test_update_iap_settings_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - service.IapSettings(name="name_value",) + service.IapSettings( + name="name_value", + ) ) response = await client.update_iap_settings(request) @@ -1422,7 +1517,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IdentityAwareProxyAdminServiceClient( - 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. @@ -1443,7 +1539,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = IdentityAwareProxyAdminServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -1460,7 +1557,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IdentityAwareProxyAdminServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1509,7 +1607,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.IdentityAwareProxyAdminServiceGrpcTransport, + client.transport, + transports.IdentityAwareProxyAdminServiceGrpcTransport, ) @@ -1559,7 +1658,8 @@ def test_identity_aware_proxy_admin_service_base_transport_with_credentials_file Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.IdentityAwareProxyAdminServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1722,7 +1822,8 @@ def test_identity_aware_proxy_admin_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.IdentityAwareProxyAdminServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1734,7 +1835,8 @@ def test_identity_aware_proxy_admin_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.IdentityAwareProxyAdminServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1869,7 +1971,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 = IdentityAwareProxyAdminServiceClient.common_folder_path(folder) assert expected == actual @@ -1887,7 +1991,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 = IdentityAwareProxyAdminServiceClient.common_organization_path(organization) assert expected == actual @@ -1905,7 +2011,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 = IdentityAwareProxyAdminServiceClient.common_project_path(project) assert expected == actual @@ -1925,7 +2033,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 = IdentityAwareProxyAdminServiceClient.common_location_path( project, location @@ -1952,7 +2061,8 @@ def test_client_with_default_client_info(): transports.IdentityAwareProxyAdminServiceTransport, "_prep_wrapped_messages" ) as prep: client = IdentityAwareProxyAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1961,7 +2071,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = IdentityAwareProxyAdminServiceClient.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) @@ -1969,7 +2080,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = IdentityAwareProxyAdminServiceAsyncClient( - 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/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py index a01f37d9f7fa..497df287e041 100644 --- a/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py +++ b/packages/google-cloud-iap/tests/unit/gapic/iap_v1/test_identity_aware_proxy_o_auth_service.py @@ -97,7 +97,10 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( "client_class", - [IdentityAwareProxyOAuthServiceClient, IdentityAwareProxyOAuthServiceAsyncClient,], + [ + IdentityAwareProxyOAuthServiceClient, + IdentityAwareProxyOAuthServiceAsyncClient, + ], ) def test_identity_aware_proxy_o_auth_service_client_from_service_account_info( client_class, @@ -142,7 +145,10 @@ def test_identity_aware_proxy_o_auth_service_client_service_account_always_use_j @pytest.mark.parametrize( "client_class", - [IdentityAwareProxyOAuthServiceClient, IdentityAwareProxyOAuthServiceAsyncClient,], + [ + IdentityAwareProxyOAuthServiceClient, + IdentityAwareProxyOAuthServiceAsyncClient, + ], ) def test_identity_aware_proxy_o_auth_service_client_from_service_account_file( client_class, @@ -533,7 +539,9 @@ def test_identity_aware_proxy_o_auth_service_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) @@ -673,10 +681,17 @@ def test_identity_aware_proxy_o_auth_service_client_create_channel_credentials_f ) -@pytest.mark.parametrize("request_type", [service.ListBrandsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.ListBrandsRequest, + dict, + ], +) def test_list_brands(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -702,7 +717,8 @@ def test_list_brands_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -718,7 +734,8 @@ async def test_list_brands_async( transport: str = "grpc_asyncio", request_type=service.ListBrandsRequest ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -770,7 +787,10 @@ def test_list_brands_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 @@ -799,13 +819,23 @@ async def test_list_brands_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"] -@pytest.mark.parametrize("request_type", [service.CreateBrandRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.CreateBrandRequest, + dict, + ], +) def test_create_brand(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -840,7 +870,8 @@ def test_create_brand_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -856,7 +887,8 @@ async def test_create_brand_async( transport: str = "grpc_asyncio", request_type=service.CreateBrandRequest ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -917,7 +949,10 @@ def test_create_brand_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 @@ -944,13 +979,23 @@ async def test_create_brand_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"] -@pytest.mark.parametrize("request_type", [service.GetBrandRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + service.GetBrandRequest, + dict, + ], +) def test_get_brand(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -985,7 +1030,8 @@ def test_get_brand_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1001,7 +1047,8 @@ async def test_get_brand_async( transport: str = "grpc_asyncio", request_type=service.GetBrandRequest ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1062,7 +1109,10 @@ def test_get_brand_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 @@ -1089,15 +1139,23 @@ async def test_get_brand_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"] @pytest.mark.parametrize( - "request_type", [service.CreateIdentityAwareProxyClientRequest, dict,] + "request_type", + [ + service.CreateIdentityAwareProxyClientRequest, + dict, + ], ) def test_create_identity_aware_proxy_client(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1110,7 +1168,9 @@ def test_create_identity_aware_proxy_client(request_type, transport: str = "grpc ) as call: # Designate an appropriate return value for the call. call.return_value = service.IdentityAwareProxyClient( - name="name_value", secret="secret_value", display_name="display_name_value", + name="name_value", + secret="secret_value", + display_name="display_name_value", ) response = client.create_identity_aware_proxy_client(request) @@ -1130,7 +1190,8 @@ def test_create_identity_aware_proxy_client_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1149,7 +1210,8 @@ async def test_create_identity_aware_proxy_client_async( request_type=service.CreateIdentityAwareProxyClientRequest, ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1212,7 +1274,10 @@ def test_create_identity_aware_proxy_client_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 @@ -1243,15 +1308,23 @@ async def test_create_identity_aware_proxy_client_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"] @pytest.mark.parametrize( - "request_type", [service.ListIdentityAwareProxyClientsRequest, dict,] + "request_type", + [ + service.ListIdentityAwareProxyClientsRequest, + dict, + ], ) def test_list_identity_aware_proxy_clients(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1282,7 +1355,8 @@ def test_list_identity_aware_proxy_clients_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1301,7 +1375,8 @@ async def test_list_identity_aware_proxy_clients_async( request_type=service.ListIdentityAwareProxyClientsRequest, ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1360,7 +1435,10 @@ def test_list_identity_aware_proxy_clients_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 @@ -1391,12 +1469,16 @@ async def test_list_identity_aware_proxy_clients_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_identity_aware_proxy_clients_pager(transport_name: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - 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. @@ -1414,10 +1496,13 @@ def test_list_identity_aware_proxy_clients_pager(transport_name: str = "grpc"): next_page_token="abc", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[], next_page_token="def", + identity_aware_proxy_clients=[], + next_page_token="def", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[service.IdentityAwareProxyClient(),], + identity_aware_proxy_clients=[ + service.IdentityAwareProxyClient(), + ], next_page_token="ghi", ), service.ListIdentityAwareProxyClientsResponse( @@ -1444,7 +1529,8 @@ def test_list_identity_aware_proxy_clients_pager(transport_name: str = "grpc"): def test_list_identity_aware_proxy_clients_pages(transport_name: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - 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. @@ -1462,10 +1548,13 @@ def test_list_identity_aware_proxy_clients_pages(transport_name: str = "grpc"): next_page_token="abc", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[], next_page_token="def", + identity_aware_proxy_clients=[], + next_page_token="def", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[service.IdentityAwareProxyClient(),], + identity_aware_proxy_clients=[ + service.IdentityAwareProxyClient(), + ], next_page_token="ghi", ), service.ListIdentityAwareProxyClientsResponse( @@ -1504,10 +1593,13 @@ async def test_list_identity_aware_proxy_clients_async_pager(): next_page_token="abc", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[], next_page_token="def", + identity_aware_proxy_clients=[], + next_page_token="def", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[service.IdentityAwareProxyClient(),], + identity_aware_proxy_clients=[ + service.IdentityAwareProxyClient(), + ], next_page_token="ghi", ), service.ListIdentityAwareProxyClientsResponse( @@ -1518,7 +1610,9 @@ async def test_list_identity_aware_proxy_clients_async_pager(): ), RuntimeError, ) - async_pager = await client.list_identity_aware_proxy_clients(request={},) + async_pager = await client.list_identity_aware_proxy_clients( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1551,10 +1645,13 @@ async def test_list_identity_aware_proxy_clients_async_pages(): next_page_token="abc", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[], next_page_token="def", + identity_aware_proxy_clients=[], + next_page_token="def", ), service.ListIdentityAwareProxyClientsResponse( - identity_aware_proxy_clients=[service.IdentityAwareProxyClient(),], + identity_aware_proxy_clients=[ + service.IdentityAwareProxyClient(), + ], next_page_token="ghi", ), service.ListIdentityAwareProxyClientsResponse( @@ -1575,11 +1672,16 @@ async def test_list_identity_aware_proxy_clients_async_pages(): @pytest.mark.parametrize( - "request_type", [service.GetIdentityAwareProxyClientRequest, dict,] + "request_type", + [ + service.GetIdentityAwareProxyClientRequest, + dict, + ], ) def test_get_identity_aware_proxy_client(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1592,7 +1694,9 @@ def test_get_identity_aware_proxy_client(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = service.IdentityAwareProxyClient( - name="name_value", secret="secret_value", display_name="display_name_value", + name="name_value", + secret="secret_value", + display_name="display_name_value", ) response = client.get_identity_aware_proxy_client(request) @@ -1612,7 +1716,8 @@ def test_get_identity_aware_proxy_client_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1631,7 +1736,8 @@ async def test_get_identity_aware_proxy_client_async( request_type=service.GetIdentityAwareProxyClientRequest, ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1694,7 +1800,10 @@ def test_get_identity_aware_proxy_client_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 @@ -1725,17 +1834,25 @@ async def test_get_identity_aware_proxy_client_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"] @pytest.mark.parametrize( - "request_type", [service.ResetIdentityAwareProxyClientSecretRequest, dict,] + "request_type", + [ + service.ResetIdentityAwareProxyClientSecretRequest, + dict, + ], ) def test_reset_identity_aware_proxy_client_secret( request_type, transport: str = "grpc" ): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1748,7 +1865,9 @@ def test_reset_identity_aware_proxy_client_secret( ) as call: # Designate an appropriate return value for the call. call.return_value = service.IdentityAwareProxyClient( - name="name_value", secret="secret_value", display_name="display_name_value", + name="name_value", + secret="secret_value", + display_name="display_name_value", ) response = client.reset_identity_aware_proxy_client_secret(request) @@ -1768,7 +1887,8 @@ def test_reset_identity_aware_proxy_client_secret_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1787,7 +1907,8 @@ async def test_reset_identity_aware_proxy_client_secret_async( request_type=service.ResetIdentityAwareProxyClientSecretRequest, ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1850,7 +1971,10 @@ def test_reset_identity_aware_proxy_client_secret_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 @@ -1881,15 +2005,23 @@ async def test_reset_identity_aware_proxy_client_secret_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"] @pytest.mark.parametrize( - "request_type", [service.DeleteIdentityAwareProxyClientRequest, dict,] + "request_type", + [ + service.DeleteIdentityAwareProxyClientRequest, + dict, + ], ) def test_delete_identity_aware_proxy_client(request_type, transport: str = "grpc"): client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1917,7 +2049,8 @@ def test_delete_identity_aware_proxy_client_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 = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1936,7 +2069,8 @@ async def test_delete_identity_aware_proxy_client_async( request_type=service.DeleteIdentityAwareProxyClientRequest, ): client = IdentityAwareProxyOAuthServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1990,7 +2124,10 @@ def test_delete_identity_aware_proxy_client_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 @@ -2019,7 +2156,10 @@ async def test_delete_identity_aware_proxy_client_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_credentials_transport_error(): @@ -2029,7 +2169,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IdentityAwareProxyOAuthServiceClient( - 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. @@ -2050,7 +2191,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = IdentityAwareProxyOAuthServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2067,7 +2209,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IdentityAwareProxyOAuthServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2116,7 +2259,8 @@ def test_transport_grpc_default(): credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.IdentityAwareProxyOAuthServiceGrpcTransport, + client.transport, + transports.IdentityAwareProxyOAuthServiceGrpcTransport, ) @@ -2169,7 +2313,8 @@ def test_identity_aware_proxy_o_auth_service_base_transport_with_credentials_fil Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.IdentityAwareProxyOAuthServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2332,7 +2477,8 @@ def test_identity_aware_proxy_o_auth_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.IdentityAwareProxyOAuthServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2344,7 +2490,8 @@ def test_identity_aware_proxy_o_auth_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.IdentityAwareProxyOAuthServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2479,7 +2626,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 = IdentityAwareProxyOAuthServiceClient.common_folder_path(folder) assert expected == actual @@ -2497,7 +2646,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 = IdentityAwareProxyOAuthServiceClient.common_organization_path(organization) assert expected == actual @@ -2515,7 +2666,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 = IdentityAwareProxyOAuthServiceClient.common_project_path(project) assert expected == actual @@ -2535,7 +2688,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 = IdentityAwareProxyOAuthServiceClient.common_location_path( project, location @@ -2562,7 +2716,8 @@ def test_client_with_default_client_info(): transports.IdentityAwareProxyOAuthServiceTransport, "_prep_wrapped_messages" ) as prep: client = IdentityAwareProxyOAuthServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2571,7 +2726,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = IdentityAwareProxyOAuthServiceClient.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) @@ -2579,7 +2735,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = IdentityAwareProxyOAuthServiceAsyncClient( - 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"