From b0ca76fa8db3930e4a46efffb7254e42bb4cb9e5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 15:29:36 -0500 Subject: [PATCH] chore: use gapic-generator-python 0.56.2 (#192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/cloud_tasks/async_client.py | 13 +- .../tasks_v2/services/cloud_tasks/client.py | 25 ++- .../services/cloud_tasks/transports/base.py | 8 +- .../services/cloud_tasks/transports/grpc.py | 4 +- .../cloud_tasks/transports/grpc_asyncio.py | 4 +- .../google/cloud/tasks_v2/types/target.py | 2 + .../google/cloud/tasks_v2/types/task.py | 2 + .../services/cloud_tasks/async_client.py | 13 +- .../services/cloud_tasks/client.py | 25 ++- .../services/cloud_tasks/transports/base.py | 8 +- .../services/cloud_tasks/transports/grpc.py | 4 +- .../cloud_tasks/transports/grpc_asyncio.py | 4 +- .../google/cloud/tasks_v2beta2/types/queue.py | 4 + .../google/cloud/tasks_v2beta2/types/task.py | 2 + .../services/cloud_tasks/async_client.py | 13 +- .../services/cloud_tasks/client.py | 25 ++- .../services/cloud_tasks/transports/base.py | 8 +- .../services/cloud_tasks/transports/grpc.py | 4 +- .../cloud_tasks/transports/grpc_asyncio.py | 4 +- .../google/cloud/tasks_v2beta3/types/queue.py | 1 + .../cloud/tasks_v2beta3/types/target.py | 2 + .../google/cloud/tasks_v2beta3/types/task.py | 3 + .../unit/gapic/tasks_v2/test_cloud_tasks.py | 160 +++++++++++---- .../gapic/tasks_v2beta2/test_cloud_tasks.py | 192 +++++++++++++----- .../gapic/tasks_v2beta3/test_cloud_tasks.py | 160 +++++++++++---- 25 files changed, 499 insertions(+), 191 deletions(-) diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/async_client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/async_client.py index 30368be84191..250d60b759c9 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/async_client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2.services.cloud_tasks import pagers from google.cloud.tasks_v2.types import cloudtasks diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/client.py index d78f1cca6ebb..04e5cd0623a3 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2.services.cloud_tasks import pagers from google.cloud.tasks_v2.types import cloudtasks @@ -309,8 +311,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/base.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/base.py index 7f09c66956de..e6e49b637b7d 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/base.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc.py index fac91df73ceb..47efb9624650 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc_asyncio.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc_asyncio.py index bbcd2d04232e..8a25d355e968 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc_asyncio.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/types/target.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/types/target.py index 3920caec173a..c1e1858c6268 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/types/target.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/types/target.py @@ -150,6 +150,7 @@ class HttpRequest(proto.Message): This type of authorization should generally only be used when calling Google APIs hosted on \*.googleapis.com. + This field is a member of `oneof`_ ``authorization_header``. oidc_token (google.cloud.tasks_v2.types.OidcToken): If specified, an @@ -160,6 +161,7 @@ class HttpRequest(proto.Message): This type of authorization can be used for many scenarios, including calling Cloud Run, or endpoints where you intend to validate the token yourself. + This field is a member of `oneof`_ ``authorization_header``. """ diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2/types/task.py b/packages/google-cloud-tasks/google/cloud/tasks_v2/types/task.py index cb0bf0f34099..58102e05db13 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2/types/task.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2/types/task.py @@ -68,12 +68,14 @@ class Task(proto.Message): An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set. + This field is a member of `oneof`_ ``message_type``. http_request (google.cloud.tasks_v2.types.HttpRequest): HTTP request that is sent to the worker. An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2.HttpRequest] set. + This field is a member of `oneof`_ ``message_type``. schedule_time (google.protobuf.timestamp_pb2.Timestamp): The time when the task is scheduled to be attempted or diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py index 327e499e070f..072eb6bd3221 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2beta2.services.cloud_tasks import pagers from google.cloud.tasks_v2beta2.types import cloudtasks diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/client.py index 07d6cb1e6705..7188dc89b923 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2beta2.services.cloud_tasks import pagers from google.cloud.tasks_v2beta2.types import cloudtasks @@ -309,8 +311,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/base.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/base.py index 3999598188b7..493e32f2ebf0 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/base.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc.py index ed244b9d3a31..a5b58157911f 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc_asyncio.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc_asyncio.py index 989147ff7578..c58456b2c869 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc_asyncio.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/services/cloud_tasks/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/queue.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/queue.py index e8eaccda3d09..cdb04733fdf3 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/queue.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/queue.py @@ -68,12 +68,14 @@ class Queue(proto.Message): An App Engine queue is a queue that has an [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget]. + This field is a member of `oneof`_ ``target_type``. pull_target (google.cloud.tasks_v2beta2.types.PullTarget): Pull target. A pull queue is a queue that has a [PullTarget][google.cloud.tasks.v2beta2.PullTarget]. + This field is a member of `oneof`_ ``target_type``. rate_limits (google.cloud.tasks_v2beta2.types.RateLimits): Rate limits for task dispatches. @@ -308,10 +310,12 @@ class RetryConfig(proto.Message): Cloud Tasks will attempt the task ``max_attempts`` times (that is, if the first attempt fails, then there will be ``max_attempts - 1`` retries). Must be > 0. + This field is a member of `oneof`_ ``num_attempts``. unlimited_attempts (bool): If true, then the number of attempts is unlimited. + This field is a member of `oneof`_ ``num_attempts``. max_retry_duration (google.protobuf.duration_pb2.Duration): If positive, ``max_retry_duration`` specifies the time limit diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/task.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/task.py index c5f6576055cd..7d2039546ec8 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/task.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta2/types/task.py @@ -71,6 +71,7 @@ class Task(proto.Message): An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set. + This field is a member of `oneof`_ ``payload_type``. pull_message (google.cloud.tasks_v2beta2.types.PullMessage): [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] @@ -80,6 +81,7 @@ class Task(proto.Message): A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set. + This field is a member of `oneof`_ ``payload_type``. schedule_time (google.protobuf.timestamp_pb2.Timestamp): The time when the task is scheduled to be attempted. diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py index cd05f11ef9b4..e65ae3687719 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2beta3.services.cloud_tasks import pagers from google.cloud.tasks_v2beta3.types import cloudtasks diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/client.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/client.py index 66d0ea5f2148..1012117c909c 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/client.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.tasks_v2beta3.services.cloud_tasks import pagers from google.cloud.tasks_v2beta3.types import cloudtasks @@ -309,8 +311,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/base.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/base.py index 050ec955de0c..8e7d3c1f9490 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/base.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc.py index 771097497f90..3f0bb485b0c4 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc_asyncio.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc_asyncio.py index 542d9adeb3e0..faad7554f89c 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc_asyncio.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/services/cloud_tasks/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/queue.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/queue.py index ef4455a65e70..85b10bde1679 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/queue.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/queue.py @@ -72,6 +72,7 @@ class Queue(proto.Message): this queue. [Http tasks][google.cloud.tasks.v2beta3.HttpRequest] are not affected by this proto. + This field is a member of `oneof`_ ``queue_type``. rate_limits (google.cloud.tasks_v2beta3.types.RateLimits): Rate limits for task dispatches. diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/target.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/target.py index d1899617b563..9f0e5e448cd2 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/target.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/target.py @@ -184,6 +184,7 @@ class HttpRequest(proto.Message): This type of authorization should generally only be used when calling Google APIs hosted on \*.googleapis.com. + This field is a member of `oneof`_ ``authorization_header``. oidc_token (google.cloud.tasks_v2beta3.types.OidcToken): If specified, an @@ -194,6 +195,7 @@ class HttpRequest(proto.Message): This type of authorization can be used for many scenarios, including calling Cloud Run, or endpoints where you intend to validate the token yourself. + This field is a member of `oneof`_ ``authorization_header``. """ diff --git a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/task.py b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/task.py index a567cd8fc91b..3fb084661e23 100644 --- a/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/task.py +++ b/packages/google-cloud-tasks/google/cloud/tasks_v2beta3/types/task.py @@ -68,12 +68,14 @@ class Task(proto.Message): An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] set. + This field is a member of `oneof`_ ``payload_type``. http_request (google.cloud.tasks_v2beta3.types.HttpRequest): HTTP request that is sent to the task's target. An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2beta3.HttpRequest] set. + This field is a member of `oneof`_ ``payload_type``. pull_message (google.cloud.tasks_v2beta3.types.PullMessage): Pull Message contained in a task in a @@ -85,6 +87,7 @@ class Task(proto.Message): queues to provide a way to inspect contents of pull tasks through the [CloudTasks.GetTask][google.cloud.tasks.v2beta3.CloudTasks.GetTask]. + This field is a member of `oneof`_ ``payload_type``. schedule_time (google.protobuf.timestamp_pb2.Timestamp): The time when the task is scheduled to be attempted. diff --git a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py index 3531564f683b..12dcbe414454 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2/test_cloud_tasks.py @@ -627,7 +627,9 @@ def test_list_queues_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_queues_flattened_error(): @@ -661,7 +663,9 @@ async def test_list_queues_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -937,7 +941,9 @@ def test_get_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_queue_flattened_error(): @@ -969,7 +975,9 @@ async def test_get_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1135,8 +1143,12 @@ def test_create_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val def test_create_queue_flattened_error(): @@ -1172,8 +1184,12 @@ async def test_create_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -1342,8 +1358,12 @@ def test_update_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_queue_flattened_error(): @@ -1380,8 +1400,12 @@ async def test_update_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -1539,7 +1563,9 @@ def test_delete_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_queue_flattened_error(): @@ -1571,7 +1597,9 @@ async def test_delete_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1735,7 +1763,9 @@ def test_purge_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_purge_queue_flattened_error(): @@ -1767,7 +1797,9 @@ async def test_purge_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1931,7 +1963,9 @@ def test_pause_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_pause_queue_flattened_error(): @@ -1963,7 +1997,9 @@ async def test_pause_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2127,7 +2163,9 @@ def test_resume_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_resume_queue_flattened_error(): @@ -2159,7 +2197,9 @@ async def test_resume_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2336,7 +2376,9 @@ def test_get_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_get_iam_policy_flattened_error(): @@ -2368,7 +2410,9 @@ async def test_get_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2545,7 +2589,9 @@ def test_set_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_set_iam_policy_flattened_error(): @@ -2577,7 +2623,9 @@ async def test_set_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2775,8 +2823,12 @@ def test_test_iam_permissions_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val def test_test_iam_permissions_flattened_error(): @@ -2816,8 +2868,12 @@ async def test_test_iam_permissions_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val @pytest.mark.asyncio @@ -2981,7 +3037,9 @@ def test_list_tasks_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_tasks_flattened_error(): @@ -3015,7 +3073,9 @@ async def test_list_tasks_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3294,7 +3354,9 @@ def test_get_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_task_flattened_error(): @@ -3326,7 +3388,9 @@ async def test_get_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3507,8 +3571,12 @@ def test_create_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val def test_create_task_flattened_error(): @@ -3544,8 +3612,12 @@ async def test_create_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3703,7 +3775,9 @@ def test_delete_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_task_flattened_error(): @@ -3735,7 +3809,9 @@ async def test_delete_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3912,7 +3988,9 @@ def test_run_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_run_task_flattened_error(): @@ -3944,7 +4022,9 @@ async def test_run_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio diff --git a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py index d3c4871fb029..37590e768fb4 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta2/test_cloud_tasks.py @@ -627,7 +627,9 @@ def test_list_queues_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_queues_flattened_error(): @@ -661,7 +663,9 @@ async def test_list_queues_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -943,7 +947,9 @@ def test_get_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_queue_flattened_error(): @@ -975,7 +981,9 @@ async def test_get_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1147,8 +1155,12 @@ def test_create_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val def test_create_queue_flattened_error(): @@ -1184,8 +1196,12 @@ async def test_create_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -1360,8 +1376,12 @@ def test_update_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_queue_flattened_error(): @@ -1398,8 +1418,12 @@ async def test_update_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -1557,7 +1581,9 @@ def test_delete_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_queue_flattened_error(): @@ -1589,7 +1615,9 @@ async def test_delete_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1759,7 +1787,9 @@ def test_purge_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_purge_queue_flattened_error(): @@ -1791,7 +1821,9 @@ async def test_purge_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1961,7 +1993,9 @@ def test_pause_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_pause_queue_flattened_error(): @@ -1993,7 +2027,9 @@ async def test_pause_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2163,7 +2199,9 @@ def test_resume_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_resume_queue_flattened_error(): @@ -2195,7 +2233,9 @@ async def test_resume_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2372,7 +2412,9 @@ def test_get_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_get_iam_policy_flattened_error(): @@ -2404,7 +2446,9 @@ async def test_get_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2581,7 +2625,9 @@ def test_set_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_set_iam_policy_flattened_error(): @@ -2613,7 +2659,9 @@ async def test_set_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2811,8 +2859,12 @@ def test_test_iam_permissions_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val def test_test_iam_permissions_flattened_error(): @@ -2852,8 +2904,12 @@ async def test_test_iam_permissions_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val @pytest.mark.asyncio @@ -3017,7 +3073,9 @@ def test_list_tasks_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_tasks_flattened_error(): @@ -3051,7 +3109,9 @@ async def test_list_tasks_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3319,7 +3379,9 @@ def test_get_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_task_flattened_error(): @@ -3351,7 +3413,9 @@ async def test_get_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3521,8 +3585,12 @@ def test_create_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val def test_create_task_flattened_error(): @@ -3558,8 +3626,12 @@ async def test_create_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3717,7 +3789,9 @@ def test_delete_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_task_flattened_error(): @@ -3749,7 +3823,9 @@ async def test_delete_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3911,7 +3987,9 @@ def test_lease_tasks_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val assert DurationRule().to_proto(args[0].lease_duration) == duration_pb2.Duration( seconds=751 ) @@ -3952,7 +4030,9 @@ async def test_lease_tasks_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val assert DurationRule().to_proto(args[0].lease_duration) == duration_pb2.Duration( seconds=751 ) @@ -4115,7 +4195,9 @@ def test_acknowledge_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4154,7 +4236,9 @@ async def test_acknowledge_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4331,7 +4415,9 @@ def test_renew_lease_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4376,7 +4462,9 @@ async def test_renew_lease_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4555,7 +4643,9 @@ def test_cancel_lease_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4594,7 +4684,9 @@ async def test_cancel_lease_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val assert TimestampRule().to_proto( args[0].schedule_time ) == timestamp_pb2.Timestamp(seconds=751) @@ -4765,7 +4857,9 @@ def test_run_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_run_task_flattened_error(): @@ -4797,7 +4891,9 @@ async def test_run_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio diff --git a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py index b011faf914da..cf93e421e1f5 100644 --- a/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py +++ b/packages/google-cloud-tasks/tests/unit/gapic/tasks_v2beta3/test_cloud_tasks.py @@ -627,7 +627,9 @@ def test_list_queues_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_queues_flattened_error(): @@ -661,7 +663,9 @@ async def test_list_queues_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -950,7 +954,9 @@ def test_get_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_queue_flattened_error(): @@ -982,7 +988,9 @@ async def test_get_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1161,8 +1169,12 @@ def test_create_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val def test_create_queue_flattened_error(): @@ -1198,8 +1210,12 @@ async def test_create_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].queue == gct_queue.Queue(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -1381,8 +1397,12 @@ def test_update_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_queue_flattened_error(): @@ -1419,8 +1439,12 @@ async def test_update_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].queue == gct_queue.Queue(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].queue + mock_val = gct_queue.Queue(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -1578,7 +1602,9 @@ def test_delete_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_queue_flattened_error(): @@ -1610,7 +1636,9 @@ async def test_delete_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1787,7 +1815,9 @@ def test_purge_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_purge_queue_flattened_error(): @@ -1819,7 +1849,9 @@ async def test_purge_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1996,7 +2028,9 @@ def test_pause_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_pause_queue_flattened_error(): @@ -2028,7 +2062,9 @@ async def test_pause_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2205,7 +2241,9 @@ def test_resume_queue_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_resume_queue_flattened_error(): @@ -2237,7 +2275,9 @@ async def test_resume_queue_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2414,7 +2454,9 @@ def test_get_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_get_iam_policy_flattened_error(): @@ -2446,7 +2488,9 @@ async def test_get_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2623,7 +2667,9 @@ def test_set_iam_policy_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val def test_set_iam_policy_flattened_error(): @@ -2655,7 +2701,9 @@ async def test_set_iam_policy_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2853,8 +2901,12 @@ def test_test_iam_permissions_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val def test_test_iam_permissions_flattened_error(): @@ -2894,8 +2946,12 @@ async def test_test_iam_permissions_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].resource == "resource_value" - assert args[0].permissions == ["permissions_value"] + arg = args[0].resource + mock_val = "resource_value" + assert arg == mock_val + arg = args[0].permissions + mock_val = ["permissions_value"] + assert arg == mock_val @pytest.mark.asyncio @@ -3059,7 +3115,9 @@ def test_list_tasks_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_tasks_flattened_error(): @@ -3093,7 +3151,9 @@ async def test_list_tasks_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3372,7 +3432,9 @@ def test_get_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_task_flattened_error(): @@ -3404,7 +3466,9 @@ async def test_get_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3585,8 +3649,12 @@ def test_create_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val def test_create_task_flattened_error(): @@ -3622,8 +3690,12 @@ async def test_create_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].task == gct_task.Task(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].task + mock_val = gct_task.Task(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3781,7 +3853,9 @@ def test_delete_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_task_flattened_error(): @@ -3813,7 +3887,9 @@ async def test_delete_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3990,7 +4066,9 @@ def test_run_task_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_run_task_flattened_error(): @@ -4022,7 +4100,9 @@ async def test_run_task_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio