From e1ca1f4f177574bacd31289c1068a030b6a4e853 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:56:25 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#181) 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 +- .../google-cloud-access-approval/docs/conf.py | 5 +- .../services/access_approval/async_client.py | 52 ++- .../services/access_approval/client.py | 109 ++++- .../access_approval/transports/base.py | 6 +- .../access_approval/transports/grpc.py | 3 +- .../accessapproval_v1/types/accessapproval.py | 187 ++++++-- .../google-cloud-access-approval/noxfile.py | 9 +- .../accessapproval_v1/test_access_approval.py | 425 +++++++++++++----- 9 files changed, 608 insertions(+), 190 deletions(-) diff --git a/packages/google-cloud-access-approval/.github/.OwlBot.lock.yaml b/packages/google-cloud-access-approval/.github/.OwlBot.lock.yaml index 88076277a251..87dd00611576 100644 --- a/packages/google-cloud-access-approval/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-access-approval/.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-access-approval/docs/conf.py b/packages/google-cloud-access-approval/docs/conf.py index 7bb96509991e..10174da3f236 100644 --- a/packages/google-cloud-access-approval/docs/conf.py +++ b/packages/google-cloud-access-approval/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/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/async_client.py b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/async_client.py index f7d51cd03843..8e50a1974022 100644 --- a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/async_client.py +++ b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/async_client.py @@ -349,12 +349,20 @@ def sample_list_approval_requests(): ) # 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.ListApprovalRequestsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -454,7 +462,12 @@ def sample_get_approval_request(): ) # 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 @@ -526,7 +539,12 @@ def sample_approve_approval_request(): ) # 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 +621,12 @@ def sample_dismiss_approval_request(): ) # 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 @@ -705,7 +728,12 @@ def sample_get_access_approval_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 @@ -817,7 +845,12 @@ def sample_update_access_approval_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 @@ -906,7 +939,10 @@ def sample_delete_access_approval_settings(): # 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/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/client.py b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/client.py index 8eec78bf5a66..50ff2fe56850 100644 --- a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/client.py +++ b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/client.py @@ -57,7 +57,10 @@ class AccessApprovalClientMeta(type): _transport_registry["grpc"] = AccessApprovalGrpcTransport _transport_registry["grpc_asyncio"] = AccessApprovalGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AccessApprovalTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AccessApprovalTransport]: """Returns an appropriate transport class. Args: @@ -197,9 +200,13 @@ def transport(self) -> AccessApprovalTransport: return self._transport @staticmethod - def access_approval_settings_path(project: str,) -> str: + def access_approval_settings_path( + project: str, + ) -> str: """Returns a fully-qualified access_approval_settings string.""" - return "projects/{project}/accessApprovalSettings".format(project=project,) + return "projects/{project}/accessApprovalSettings".format( + project=project, + ) @staticmethod def parse_access_approval_settings_path(path: str) -> Dict[str, str]: @@ -208,10 +215,14 @@ def parse_access_approval_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def approval_request_path(project: str, approval_request: str,) -> str: + def approval_request_path( + project: str, + approval_request: str, + ) -> str: """Returns a fully-qualified approval_request string.""" return "projects/{project}/approvalRequests/{approval_request}".format( - project=project, approval_request=approval_request, + project=project, + approval_request=approval_request, ) @staticmethod @@ -224,7 +235,9 @@ def parse_approval_request_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, @@ -237,9 +250,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]: @@ -248,9 +265,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]: @@ -259,9 +280,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]: @@ -270,10 +295,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 @@ -540,12 +569,20 @@ def sample_list_approval_requests(): ) # 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.ListApprovalRequestsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -636,7 +673,12 @@ def sample_get_approval_request(): ) # 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 @@ -709,7 +751,12 @@ def sample_approve_approval_request(): ) # 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 @@ -787,7 +834,12 @@ def sample_dismiss_approval_request(): ) # 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 @@ -882,7 +934,12 @@ def sample_get_access_approval_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 @@ -996,7 +1053,12 @@ def sample_update_access_approval_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 @@ -1087,7 +1149,10 @@ def sample_delete_access_approval_settings(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/base.py b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/base.py index 859539b095d6..008d2a13badb 100644 --- a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/base.py +++ b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/base.py @@ -188,9 +188,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-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/grpc.py b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/grpc.py index 10449e4b49a1..793effc6c786 100644 --- a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/grpc.py +++ b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/services/access_approval/transports/grpc.py @@ -259,8 +259,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-access-approval/google/cloud/accessapproval_v1/types/accessapproval.py b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/types/accessapproval.py index 60f53191f0de..6764650e8643 100644 --- a/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/types/accessapproval.py +++ b/packages/google-cloud-access-approval/google/cloud/accessapproval_v1/types/accessapproval.py @@ -87,8 +87,14 @@ class AccessLocations(proto.Message): - ANY: Any location """ - principal_office_country = proto.Field(proto.STRING, number=1,) - principal_physical_location_country = proto.Field(proto.STRING, number=2,) + principal_office_country = proto.Field( + proto.STRING, + number=1, + ) + principal_physical_location_country = proto.Field( + proto.STRING, + number=2, + ) class AccessReason(proto.Message): @@ -109,8 +115,15 @@ class Type(proto.Enum): GOOGLE_INITIATED_SERVICE = 2 GOOGLE_INITIATED_REVIEW = 3 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - detail = proto.Field(proto.STRING, number=2,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + detail = proto.Field( + proto.STRING, + number=2, + ) class ApproveDecision(proto.Message): @@ -125,9 +138,15 @@ class ApproveDecision(proto.Message): """ approve_time = proto.Field( - proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - expire_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) class DismissDecision(proto.Message): @@ -146,9 +165,14 @@ class DismissDecision(proto.Message): """ dismiss_time = proto.Field( - proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + implicit = proto.Field( + proto.BOOL, + number=2, ) - implicit = proto.Field(proto.BOOL, number=2,) class ResourceProperties(proto.Message): @@ -160,7 +184,10 @@ class ResourceProperties(proto.Message): descendants of the resource being requested. """ - excludes_descendants = proto.Field(proto.BOOL, number=1,) + excludes_descendants = proto.Field( + proto.BOOL, + number=1, + ) class ApprovalRequest(proto.Message): @@ -212,26 +239,50 @@ class ApprovalRequest(proto.Message): This field is a member of `oneof`_ ``decision``. """ - name = proto.Field(proto.STRING, number=1,) - requested_resource_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + requested_resource_name = proto.Field( + proto.STRING, + number=2, + ) requested_resource_properties = proto.Field( - proto.MESSAGE, number=9, message="ResourceProperties", + proto.MESSAGE, + number=9, + message="ResourceProperties", + ) + requested_reason = proto.Field( + proto.MESSAGE, + number=3, + message="AccessReason", ) - requested_reason = proto.Field(proto.MESSAGE, number=3, message="AccessReason",) requested_locations = proto.Field( - proto.MESSAGE, number=4, message="AccessLocations", + proto.MESSAGE, + number=4, + message="AccessLocations", ) request_time = proto.Field( - proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) requested_expiration = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) approve = proto.Field( - proto.MESSAGE, number=7, oneof="decision", message="ApproveDecision", + proto.MESSAGE, + number=7, + oneof="decision", + message="ApproveDecision", ) dismiss = proto.Field( - proto.MESSAGE, number=8, oneof="decision", message="DismissDecision", + proto.MESSAGE, + number=8, + oneof="decision", + message="DismissDecision", ) @@ -303,8 +354,15 @@ class EnrolledService(proto.Message): The enrollment level of the service. """ - cloud_product = proto.Field(proto.STRING, number=1,) - enrollment_level = proto.Field(proto.ENUM, number=2, enum="EnrollmentLevel",) + cloud_product = proto.Field( + proto.STRING, + number=1, + ) + enrollment_level = proto.Field( + proto.ENUM, + number=2, + enum="EnrollmentLevel", + ) class AccessApprovalSettings(proto.Message): @@ -350,12 +408,23 @@ class AccessApprovalSettings(proto.Message): ancestors). """ - name = proto.Field(proto.STRING, number=1,) - notification_emails = proto.RepeatedField(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + notification_emails = proto.RepeatedField( + proto.STRING, + number=2, + ) enrolled_services = proto.RepeatedField( - proto.MESSAGE, number=3, message="EnrolledService", + proto.MESSAGE, + number=3, + message="EnrolledService", + ) + enrolled_ancestor = proto.Field( + proto.BOOL, + number=4, ) - enrolled_ancestor = proto.Field(proto.BOOL, number=4,) class ListApprovalRequestsMessage(proto.Message): @@ -387,10 +456,22 @@ class ListApprovalRequestsMessage(proto.Message): return. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListApprovalRequestsResponse(proto.Message): @@ -409,9 +490,14 @@ def raw_page(self): return self approval_requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="ApprovalRequest", + proto.MESSAGE, + number=1, + message="ApprovalRequest", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetApprovalRequestMessage(proto.Message): @@ -423,7 +509,10 @@ class GetApprovalRequestMessage(proto.Message): "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}". """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ApproveApprovalRequestMessage(proto.Message): @@ -436,8 +525,15 @@ class ApproveApprovalRequestMessage(proto.Message): The expiration time of this approval. """ - name = proto.Field(proto.STRING, number=1,) - expire_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class DismissApprovalRequestMessage(proto.Message): @@ -448,7 +544,10 @@ class DismissApprovalRequestMessage(proto.Message): Name of the ApprovalRequest to dismiss. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GetAccessApprovalSettingsMessage(proto.Message): @@ -460,7 +559,10 @@ class GetAccessApprovalSettingsMessage(proto.Message): "{projects|folders|organizations}/{id}/accessApprovalSettings". """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateAccessApprovalSettingsMessage(proto.Message): @@ -483,9 +585,15 @@ class UpdateAccessApprovalSettingsMessage(proto.Message): field will be updated. """ - settings = proto.Field(proto.MESSAGE, number=1, message="AccessApprovalSettings",) + settings = proto.Field( + proto.MESSAGE, + number=1, + message="AccessApprovalSettings", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -497,7 +605,10 @@ class DeleteAccessApprovalSettingsMessage(proto.Message): Name of the AccessApprovalSettings to delete. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-access-approval/noxfile.py b/packages/google-cloud-access-approval/noxfile.py index 2a2001c49998..3addb4ed9431 100644 --- a/packages/google-cloud-access-approval/noxfile.py +++ b/packages/google-cloud-access-approval/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-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py b/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py index 3beb107c4948..18ec944e632d 100644 --- a/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py +++ b/packages/google-cloud-access-approval/tests/unit/gapic/accessapproval_v1/test_access_approval.py @@ -89,7 +89,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [AccessApprovalClient, AccessApprovalAsyncClient,] + "client_class", + [ + AccessApprovalClient, + AccessApprovalAsyncClient, + ], ) def test_access_approval_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -131,7 +135,11 @@ def test_access_approval_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [AccessApprovalClient, AccessApprovalAsyncClient,] + "client_class", + [ + AccessApprovalClient, + AccessApprovalAsyncClient, + ], ) def test_access_approval_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -495,7 +503,9 @@ def test_access_approval_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,11 +646,16 @@ def test_access_approval_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [accessapproval.ListApprovalRequestsMessage, dict,] + "request_type", + [ + accessapproval.ListApprovalRequestsMessage, + dict, + ], ) def test_list_approval_requests(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -671,7 +686,8 @@ def test_list_approval_requests_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -690,7 +706,8 @@ async def test_list_approval_requests_async( request_type=accessapproval.ListApprovalRequestsMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -725,7 +742,9 @@ async def test_list_approval_requests_async_from_dict(): def test_list_approval_requests_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -747,7 +766,10 @@ def test_list_approval_requests_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 @@ -778,11 +800,16 @@ async def test_list_approval_requests_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_approval_requests_flattened(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -792,7 +819,9 @@ def test_list_approval_requests_flattened(): call.return_value = accessapproval.ListApprovalRequestsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_approval_requests(parent="parent_value",) + client.list_approval_requests( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -804,13 +833,16 @@ def test_list_approval_requests_flattened(): def test_list_approval_requests_flattened_error(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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.list_approval_requests( - accessapproval.ListApprovalRequestsMessage(), parent="parent_value", + accessapproval.ListApprovalRequestsMessage(), + parent="parent_value", ) @@ -832,7 +864,9 @@ async def test_list_approval_requests_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_approval_requests(parent="parent_value",) + response = await client.list_approval_requests( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -853,13 +887,15 @@ async def test_list_approval_requests_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_approval_requests( - accessapproval.ListApprovalRequestsMessage(), parent="parent_value", + accessapproval.ListApprovalRequestsMessage(), + parent="parent_value", ) def test_list_approval_requests_pager(transport_name: str = "grpc"): client = AccessApprovalClient( - 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. @@ -877,10 +913,13 @@ def test_list_approval_requests_pager(transport_name: str = "grpc"): next_page_token="abc", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[], next_page_token="def", + approval_requests=[], + next_page_token="def", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[accessapproval.ApprovalRequest(),], + approval_requests=[ + accessapproval.ApprovalRequest(), + ], next_page_token="ghi", ), accessapproval.ListApprovalRequestsResponse( @@ -907,7 +946,8 @@ def test_list_approval_requests_pager(transport_name: str = "grpc"): def test_list_approval_requests_pages(transport_name: str = "grpc"): client = AccessApprovalClient( - 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. @@ -925,10 +965,13 @@ def test_list_approval_requests_pages(transport_name: str = "grpc"): next_page_token="abc", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[], next_page_token="def", + approval_requests=[], + next_page_token="def", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[accessapproval.ApprovalRequest(),], + approval_requests=[ + accessapproval.ApprovalRequest(), + ], next_page_token="ghi", ), accessapproval.ListApprovalRequestsResponse( @@ -946,7 +989,9 @@ def test_list_approval_requests_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_approval_requests_async_pager(): - client = AccessApprovalAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AccessApprovalAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -965,10 +1010,13 @@ async def test_list_approval_requests_async_pager(): next_page_token="abc", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[], next_page_token="def", + approval_requests=[], + next_page_token="def", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[accessapproval.ApprovalRequest(),], + approval_requests=[ + accessapproval.ApprovalRequest(), + ], next_page_token="ghi", ), accessapproval.ListApprovalRequestsResponse( @@ -979,7 +1027,9 @@ async def test_list_approval_requests_async_pager(): ), RuntimeError, ) - async_pager = await client.list_approval_requests(request={},) + async_pager = await client.list_approval_requests( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -991,7 +1041,9 @@ async def test_list_approval_requests_async_pager(): @pytest.mark.asyncio async def test_list_approval_requests_async_pages(): - client = AccessApprovalAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AccessApprovalAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1010,10 +1062,13 @@ async def test_list_approval_requests_async_pages(): next_page_token="abc", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[], next_page_token="def", + approval_requests=[], + next_page_token="def", ), accessapproval.ListApprovalRequestsResponse( - approval_requests=[accessapproval.ApprovalRequest(),], + approval_requests=[ + accessapproval.ApprovalRequest(), + ], next_page_token="ghi", ), accessapproval.ListApprovalRequestsResponse( @@ -1032,11 +1087,16 @@ async def test_list_approval_requests_async_pages(): @pytest.mark.parametrize( - "request_type", [accessapproval.GetApprovalRequestMessage, dict,] + "request_type", + [ + accessapproval.GetApprovalRequestMessage, + dict, + ], ) def test_get_approval_request(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1072,7 +1132,8 @@ def test_get_approval_request_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1091,7 +1152,8 @@ async def test_get_approval_request_async( request_type=accessapproval.GetApprovalRequestMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1128,7 +1190,9 @@ async def test_get_approval_request_async_from_dict(): def test_get_approval_request_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -1150,7 +1214,10 @@ def test_get_approval_request_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 @@ -1181,11 +1248,16 @@ async def test_get_approval_request_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_approval_request_flattened(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1195,7 +1267,9 @@ def test_get_approval_request_flattened(): call.return_value = accessapproval.ApprovalRequest() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_approval_request(name="name_value",) + client.get_approval_request( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1207,13 +1281,16 @@ def test_get_approval_request_flattened(): def test_get_approval_request_flattened_error(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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_approval_request( - accessapproval.GetApprovalRequestMessage(), name="name_value", + accessapproval.GetApprovalRequestMessage(), + name="name_value", ) @@ -1235,7 +1312,9 @@ async def test_get_approval_request_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_approval_request(name="name_value",) + response = await client.get_approval_request( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1256,16 +1335,22 @@ async def test_get_approval_request_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_approval_request( - accessapproval.GetApprovalRequestMessage(), name="name_value", + accessapproval.GetApprovalRequestMessage(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [accessapproval.ApproveApprovalRequestMessage, dict,] + "request_type", + [ + accessapproval.ApproveApprovalRequestMessage, + dict, + ], ) def test_approve_approval_request(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1301,7 +1386,8 @@ def test_approve_approval_request_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 = AccessApprovalClient( - 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 +1406,8 @@ async def test_approve_approval_request_async( request_type=accessapproval.ApproveApprovalRequestMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1357,7 +1444,9 @@ async def test_approve_approval_request_async_from_dict(): def test_approve_approval_request_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -1379,7 +1468,10 @@ def test_approve_approval_request_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 @@ -1410,15 +1502,23 @@ async def test_approve_approval_request_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", [accessapproval.DismissApprovalRequestMessage, dict,] + "request_type", + [ + accessapproval.DismissApprovalRequestMessage, + dict, + ], ) def test_dismiss_approval_request(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1454,7 +1554,8 @@ def test_dismiss_approval_request_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1473,7 +1574,8 @@ async def test_dismiss_approval_request_async( request_type=accessapproval.DismissApprovalRequestMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1510,7 +1612,9 @@ async def test_dismiss_approval_request_async_from_dict(): def test_dismiss_approval_request_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -1532,7 +1636,10 @@ def test_dismiss_approval_request_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 @@ -1563,15 +1670,23 @@ async def test_dismiss_approval_request_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", [accessapproval.GetAccessApprovalSettingsMessage, dict,] + "request_type", + [ + accessapproval.GetAccessApprovalSettingsMessage, + dict, + ], ) def test_get_access_approval_settings(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1606,7 +1721,8 @@ def test_get_access_approval_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1625,7 +1741,8 @@ async def test_get_access_approval_settings_async( request_type=accessapproval.GetAccessApprovalSettingsMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1664,7 +1781,9 @@ async def test_get_access_approval_settings_async_from_dict(): def test_get_access_approval_settings_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -1686,7 +1805,10 @@ def test_get_access_approval_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 @@ -1717,11 +1839,16 @@ async def test_get_access_approval_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"] def test_get_access_approval_settings_flattened(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1731,7 +1858,9 @@ def test_get_access_approval_settings_flattened(): call.return_value = accessapproval.AccessApprovalSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_access_approval_settings(name="name_value",) + client.get_access_approval_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1743,13 +1872,16 @@ def test_get_access_approval_settings_flattened(): def test_get_access_approval_settings_flattened_error(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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_access_approval_settings( - accessapproval.GetAccessApprovalSettingsMessage(), name="name_value", + accessapproval.GetAccessApprovalSettingsMessage(), + name="name_value", ) @@ -1771,7 +1903,9 @@ async def test_get_access_approval_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_access_approval_settings(name="name_value",) + response = await client.get_access_approval_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1792,16 +1926,22 @@ async def test_get_access_approval_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_access_approval_settings( - accessapproval.GetAccessApprovalSettingsMessage(), name="name_value", + accessapproval.GetAccessApprovalSettingsMessage(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [accessapproval.UpdateAccessApprovalSettingsMessage, dict,] + "request_type", + [ + accessapproval.UpdateAccessApprovalSettingsMessage, + dict, + ], ) def test_update_access_approval_settings(request_type, transport: str = "grpc"): client = AccessApprovalClient( - 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 +1976,8 @@ def test_update_access_approval_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1855,7 +1996,8 @@ async def test_update_access_approval_settings_async( request_type=accessapproval.UpdateAccessApprovalSettingsMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1894,7 +2036,9 @@ async def test_update_access_approval_settings_async_from_dict(): def test_update_access_approval_settings_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -1916,9 +2060,10 @@ def test_update_access_approval_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "settings.name=settings.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "settings.name=settings.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1949,13 +2094,16 @@ async def test_update_access_approval_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "settings.name=settings.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "settings.name=settings.name/value", + ) in kw["metadata"] def test_update_access_approval_settings_flattened(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1983,7 +2131,9 @@ def test_update_access_approval_settings_flattened(): def test_update_access_approval_settings_flattened_error(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2047,11 +2197,16 @@ async def test_update_access_approval_settings_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [accessapproval.DeleteAccessApprovalSettingsMessage, dict,] + "request_type", + [ + accessapproval.DeleteAccessApprovalSettingsMessage, + dict, + ], ) def test_delete_access_approval_settings(request_type, transport: str = "grpc"): client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2079,7 +2234,8 @@ def test_delete_access_approval_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 = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2098,7 +2254,8 @@ async def test_delete_access_approval_settings_async( request_type=accessapproval.DeleteAccessApprovalSettingsMessage, ): client = AccessApprovalAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2128,7 +2285,9 @@ async def test_delete_access_approval_settings_async_from_dict(): def test_delete_access_approval_settings_field_headers(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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. @@ -2150,7 +2309,10 @@ def test_delete_access_approval_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 @@ -2179,11 +2341,16 @@ async def test_delete_access_approval_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"] def test_delete_access_approval_settings_flattened(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2193,7 +2360,9 @@ def test_delete_access_approval_settings_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_access_approval_settings(name="name_value",) + client.delete_access_approval_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2205,13 +2374,16 @@ def test_delete_access_approval_settings_flattened(): def test_delete_access_approval_settings_flattened_error(): - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AccessApprovalClient( + 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.delete_access_approval_settings( - accessapproval.DeleteAccessApprovalSettingsMessage(), name="name_value", + accessapproval.DeleteAccessApprovalSettingsMessage(), + name="name_value", ) @@ -2231,7 +2403,9 @@ async def test_delete_access_approval_settings_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_access_approval_settings(name="name_value",) + response = await client.delete_access_approval_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2252,7 +2426,8 @@ async def test_delete_access_approval_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_access_approval_settings( - accessapproval.DeleteAccessApprovalSettingsMessage(), name="name_value", + accessapproval.DeleteAccessApprovalSettingsMessage(), + name="name_value", ) @@ -2263,7 +2438,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AccessApprovalClient( - 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. @@ -2283,7 +2459,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AccessApprovalClient(client_options=options, transport=transport,) + client = AccessApprovalClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2299,7 +2478,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AccessApprovalClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2344,8 +2524,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AccessApprovalClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AccessApprovalGrpcTransport,) + client = AccessApprovalClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AccessApprovalGrpcTransport, + ) def test_access_approval_base_transport_error(): @@ -2396,7 +2581,8 @@ def test_access_approval_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AccessApprovalTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2554,7 +2740,8 @@ def test_access_approval_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AccessApprovalGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2566,7 +2753,8 @@ def test_access_approval_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AccessApprovalGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2675,7 +2863,9 @@ def test_access_approval_transport_channel_mtls_with_adc(transport_class): def test_access_approval_settings_path(): project = "squid" - expected = "projects/{project}/accessApprovalSettings".format(project=project,) + expected = "projects/{project}/accessApprovalSettings".format( + project=project, + ) actual = AccessApprovalClient.access_approval_settings_path(project) assert expected == actual @@ -2695,7 +2885,8 @@ def test_approval_request_path(): project = "whelk" approval_request = "octopus" expected = "projects/{project}/approvalRequests/{approval_request}".format( - project=project, approval_request=approval_request, + project=project, + approval_request=approval_request, ) actual = AccessApprovalClient.approval_request_path(project, approval_request) assert expected == actual @@ -2735,7 +2926,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 = AccessApprovalClient.common_folder_path(folder) assert expected == actual @@ -2753,7 +2946,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 = AccessApprovalClient.common_organization_path(organization) assert expected == actual @@ -2771,7 +2966,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 = AccessApprovalClient.common_project_path(project) assert expected == actual @@ -2791,7 +2988,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 = AccessApprovalClient.common_location_path(project, location) assert expected == actual @@ -2816,7 +3014,8 @@ def test_client_with_default_client_info(): transports.AccessApprovalTransport, "_prep_wrapped_messages" ) as prep: client = AccessApprovalClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2825,7 +3024,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AccessApprovalClient.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) @@ -2833,7 +3033,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AccessApprovalAsyncClient( - 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"